So I have the following situation.
When I'm using compass just from CLI it just works and does exactly what's required. I'm running compass compile
from the same folder where config.rb
file is located (in styles
folder). It also contains also sass
and css
directories.
Here's my config.rb
file:
project_path = '.'
css_dir = "css"
sass_dir = "sass"
images_dir = "../../data/images"
javascripts_dir = "../scripts"
output_style = :compressed
environment = :development
relative_assets = true
When I'm trying to use grunt
for this I use the following configuration in Gruntfile.js
:
compass: {
compile: {
options: {
basePath: 'app/src/styles',
config: 'app/src/styles/config.rb'
}
}
}
The app
folder and Gruntfile.js
are located at the same level.
When I'm running grunt compass
I see the following output:
Running "compass:dist" (compass) task
Nothing to compile. If you're trying to start a new project, you have left off the directory argument.
Run "compass -h" to get help.
Done, without errors.
If I try to specify all the options directly like:
compass: {
compile: {
options: {
basePath: 'app/src/styles',
sassDir: 'app/src/styles/sass',
cssDir: 'app/src/styles/css',
imagesDir: 'app/data/images'
}
}
}
It does the job, but the .sass-cache
folder is created at the level of Gruntfile.js
.
So I guess there's some problem with basePath
option of the configuration.
Am I doing something wrong?
EDIT:
The only way, I managed to make it work, as intended is moving config.rb
file to the level of Gruntfile.js
, and specifying the following options in it:
project_path = 'app/src/styles'
css_dir = "css"
sass_dir = "sass"
images_dir = "../../data/images"
javascripts_dir = "../scripts"
output_style = :compressed
environment = :development
relative_assets = true
Also I removed all of the options from the 'Gruntfile.js`, which regard to this task. Still not sure, what's going on here.
Try not setting the basePath in the Grunt config, i.e:
compass: {
compile: {
options: {
basePath: 'app/src/styles',
config: 'app/src/styles/config.rb'
}
}
}
Turn into:
compass: {
compile: {
options: {
config: 'app/src/styles/config.rb'
}
}
}
And also run your Grunt Compass
with the --verbose switch (grunt compass --verbose
) to see what files grunt is trying to process.
Notice that any setting you add to your options in the Grunt file will override (or extend) the settings in your config.rb file.
Check out this page: https://github.com/gruntjs/grunt-contrib-compass
to see more info about grunt-contrib-compass. they have info about all the possible options.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With