Ho questo flusso di lavoro:grunt-contrib-watch + sass: come specificare i file di destinazione?
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks
grunt.initConfig({
sass: {
options: {
sourceMap: true
},
dist: {
}
},
watch: {
files: ['src/*.scss'],
tasks: ['sass']
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ["sass"]);
};
Dopo aver eseguito grunt watch
e cambiare un file src/*.scss
, ottengo questo:
File "src/main.scss" cambiato. Running "sass: dist" (sass) compito
Done, senza errori. Completato nel 0.949s a Fri 2 Feb 2016 11:25:11 GMT + 0100 (CET) - Waiting ...
Il mio problema: dove si trova il file generato? come specificare il file di destinazione?
ho anche provato con questo flusso di lavoro:
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks
grunt.initConfig({
sass: {
options: {
sourceMap: true
},
dist: {
files: [{
expand: true,
cwd: 'src',
src: ['*.scss'],
dest: '.',
ext: '.css'
}]
}
},
watch: {
files: ['*.scss'],
tasks: ['sass']
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ["sass"]);
};
e funzionante anche grunt watch
, ma quando cambio src/*.scss
non succede nulla ..
EDIT: questo è il mio file di grugnito dopo le risposte :
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt); // npm install --save-dev load-grunt-tasks
grunt.initConfig({
sass: {
options: {
sourceMap: true
},
dist: {
files: [{
expand: true,
cwd: '.',
src: ['src/**/*.scss'],
dest: '.',
ext: '.css'
}]
}
},
watch: {
files: ['src/**/*.scss'],
tasks: ['sass']
}
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.registerTask('default', ["sass"]);
};
Hey @ziiweb, ha fatto uno dei queste soluzioni funzionano per te? – suzumakes