I'm trying to use grunt-contrib-compass for an AngularJS project with multiple app folders. Here is my basic directory structure:
/root
/appA
/appB
...
/appX
/public
/modules
/moduleName
/css
/sass
gruntfile.js is stored in /root
My compass task is set up as follows:
compass: {
dev: {
options: {
cssDir: 'app*/public/modules/**/css',
sassDir: 'app*/public/modules/**/sass',
outputStyle: 'compressed'
}
}
}
Note the wildcard selectors (*) in "cssDir" and "sassDir".
When this task runs, it successfully finds the .scss files in the directory specified for "sass". However, upon creating the .css files, it creates a new folder structure in /root like so:
/root
/app*
/public
/modules
/**
/css
The "css" folder is left empty and the actual .css file is saved in the same directory as my .scss files.
As an example, this is the terminal output for one of the .scss files when the compass task is run:
>> File "appStudentHousing/public/modules/studentHousingHome/sass/styles.scss" changed.
Running "compass:dev" (compass) task
directory appStudentHousing/public/modules/studentHousingHome/sass
write appStudentHousing/public/modules/studentHousingHome/sass/styles.css (0.003s)
It appears that the task recognizes wildcard selectors in the "sassDir" option, but it does not recognize them in the "cssDir" option. It creates a blank folder structure with the asterisks in the actual folder name, and then for some reason it saves the output .css file in the same folder as the .scss file.
Thanks much for any insight you can provide.
cssDirandsassDiroptions because theCompassGruntplugin can only compile to one directory per given target. - Timusandev.Gruntalways defines its tasks as the task itself,compassin this case, and multiple targets for the task. You could go ahead and define more targets besidesdev(which also does not need to be calleddevby the way). To call a specific target of a task you call it withgrunt task:target. In your casegrunt compass:dev. Simply runninggrunt compassalso works here because you only have one target defined. - TimusanappXfolder, and then I can set up a uniquegrunt-contrib-watchtask for each target with the sass/css folder paths defined explicitly -- no wildcards necessary. Thank you so much Timusan. If you post your comment as an answer, I will mark it with the green checkmark. - MattSidor