0
Mit contrib-sass und contrib-watching will ich nur benötigte Dateien kompilieren weil ich eine Menge scss-Datei auf dem Produktionsserver habe.Kompilieren nur benötigt sass file whit grunt
Ich schreibe diese Gruntfile, aber etwas funktioniert nicht. Zusehen klappt, aber kompiliert nichts.
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
sass: {
files: [
'sites/**/scss/*.scss'
],
tasks: ['sass'],
options: {
spawn: false
}
}
},
sass: {
dist:{
options: {
style: 'compressed'
},
files: objDestSource
}
}
});
// On watch events configure jshint:all to only run on changed file
grunt.event.on('watch', function(action, filepath) {
var filepath_scss = filepath;
var filepath_css = filepath.replace("scss", "css");
filepath_css = filepath_css.replace("scss", "css");
filepath= '\''+filepath_css+'\' : \''+filepath_scss+'\'';
console.log(filepath);
grunt.config('sass.dist.files', filepath);
});
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default',['watch']);
};