I'm trying to create a very simple build system with Grunt in windows using Cygwin to handle compiling,concatenation and minification of my scss/css and coffee/js files.
I'm having problem with Grunt not recognizing Sass as a command.
I should note that the same Gruntfile, same tasks, same packages is working perfectly on linux (why of course!) and this problem is solely related to implementing the same system on Windows.
I have correctly installed Ruby and Sass (both "ruby -v" and "sass -v" work as expected) and i have no problem compiling scss into css from command line
$ sass --update sass:css
and it effectively converts all the .scss files into .css
Grunt itself works without problems, compiling coffee into js, concatenating js or css files, minifying them and watching for changes.
here is the complete Gruntfile.js
, for reference
module.exports = function(grunt) {
grunt.initConfig({
concat: {
js: {
src: 'js/*.js',
dest: 'build/js/scripts.js',
},
css: {
src: 'css/*.css',
dest: 'build/css/theme.css',
},
},
uglify: {
jsMin : {
files: {
'build/js/scripts.min.js' : ['build/js/scripts.js']
},
},
},
cssmin: {
styleMin : {
files : {
'build/css/theme.min.css' : ['build/css/theme.css']
},
},
},
watch: {
jsW: {
files: ['js/**/*.js'],
tasks: ['concat:js','uglify:jsMin'],
},
cssW: {
files: ['css/**/*.css'],
tasks: ['concat:css','cssmin'],
},
sassW: {
files: ['sass/**/*.scss'],
tasks: ['exec']
}
},
exec: {
Sass : 'sass --update sass:css',
Coffee : 'coffee -o js/ -c coffee/'
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-exec');
grunt.registerTask('default',['exec','concat','uglify','cssmin','watch']);
};
if then I start grunt
it displays the following alert
Running "exec:Sass" (exec) task
'sass' is not recognized as an internal or external command, operable program or batch file.
Exited with code: 1.
Warning: Task "exec:Sass" failed. Use --force to continue.
Aborted due to warnings.
as I stated before the system works perfectly on linux, so I would guess there is something wrong with my Paths, but why then would sass work fine from command line and not being recognized through grunt?
last thing I would like to point out is that, during some digging and testing to try and guess what the problem was before posting here on SO, I found out that calling out any bash function that has not an .exe file in cygwin/bin shows the same error
https://i.stack.imgur.com/DGLe5.png (testing on files 'sass' 'sdoc' and 'ruby.exe')
modified grunt-exec for testing:
exec: {
Sass : 'sass -v',
Ruby : 'ruby -v',
Sdoc : 'sdoc -v',
}
and they showed the following after grunt --force
https://i.stack.imgur.com/3boy7.png
while from normal command-line
$ sass -v && ruby -v && sdoc -v
Sass 3.4.16 (Selective Steve)
ruby 2.0.0p598 (2014-11-13) [x86_64-cygwin]
4.2.0
I seriously have no idea where to go from here, any help would be appreciated.