Witam. Jest to moj pierwszy dzien z gruntem i mam klopot. Mianowicie grunt nie widzi zadnego z zadan poza tym ktore zostalo dodane jako pierwsze.
Korzystalem z tych poradnikow:
https://24ways.org/2013/grunt-is-not-weird-and-hard/
https://css-tricks.com/autoprefixer/
Moj plik Gruntfile.js
module.exports = function(grunt) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
build: {
src: "scripts/app.js",
dest: "scripts/app-final.js"
}
},
sass: {
dist: {
options: {
style: 'compressed'
},
files: {
'content/app.css': 'content/app.scss'
}
}
},
autoprefixer: {
dist: {
files: {
'content/app-prefixed.css': 'content/app.css'
}
}
},
imagemin: {
dynamic: {
files: [{
expand: true,
cwd: 'assets/img/',
src: ['**/*.{png,jpg,gif}'],
dest: 'assets/img/'
}]
}
},
watch: {
scripts: {
files: ['scripts/app.js'],
tasks: ['uglify'],
options: {
spawn: false,
}
},
css: {
files: ['content/app.scss'],
tasks: ['sass'],
options: {
spawn: false,
}
},
styles: {
files: ['content/app.css'],
tasks: ['autoprefixer']
}
}
});
// 3. Where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks(
'grunt-contrib-uglify',
'grunt-contrib-sass',
'grunt-autoprefixer',
'grunt-contrib-imagemin',
'grunt-contrib-watch'
);
// 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
grunt.registerTask(
'default', [
'uglify',
'sass',
'autoprefixer',
'imagemin',
'watch'
]);
};
Po wpisaniu grunt uglify otrzymuje to:
# grunt uglify
Running "uglify:build" (uglify) task
>> Destination scripts/app-final.js not written because src files were empty.
>> No files created.
Done, without errors.
Czyli dziala.
Po wpisaniu grunt watch otrzymuje to;
# grunt watch
Warning: Task "watch" not found. Use --force to continue.
Aborted due to warnings.
grunt help daje mi to:
Available tasks
uglify Minify files with UglifyJS. *
default Alias for "watch", "uglify", "sass", "autoprefixer", "imagemin" tasks.
Nie widze zadnej roznicy miedzy uglify a innymi fcjami. Restart terminala nie pomaga. Reinstall zadan tez nie. Uzywam Linuxa gdyby to mialo jakies znaczenie. Node zainstalowany