Closed xavierartot closed 9 years ago
Could you post your Grunt config please?
'use strict';
module.exports = function(grunt) {
// Load all tasks
require('load-grunt-tasks')(grunt);
// Show elapsed time
require('time-grunt')(grunt);
var jsFileList = [
'assets/bower_components/jquery/dist/jquery.js',
'assets/bower_components/bootstrap-sass/assets/javascripts/bootstrap/transition.js',
//'assets/bower_components/bootstrap-sass/assets/javascripts/bootstrap/alert.js',
//'assets/bower_components/bootstrap-sass/assets/javascripts/bootstrap/button.js',
'assets/bower_components/bootstrap-sass/assets/javascripts/bootstrap/carousel.js',
//'assets/bower_components/bootstrap-sass/assets/javascripts/bootstrap/collapse.js',
//'assets/bower_components/bootstrap-sass/assets/javascripts/bootstrap/dropdown.js',
//'assets/bower_components/bootstrap-sass/assets/javascripts/bootstrap/modal.js',
//'assets/bower_components/bootstrap-sass/assets/javascripts/bootstrap/tooltip.js',
//'assets/bower_components/bootstrap-sass/assets/javascripts/bootstrap/popover.js',
//'assets/bower_components/bootstrap-sass/assets/javascripts/bootstrap/scrollspy.js',
//'assets/bower_components/bootstrap-sass/assets/javascripts/bootstrap/tab.js',
//'assets/bower_components/bootstrap-sass/assets/javascripts/bootstrap/affix.js',
'assets/bower_components/modernizr/modernizr.js',
'assets/bower_components/jquery-touchswipe/jquery.touchSwipe.js',
'assets/bower_components/waypoints/lib/jquery.waypoints.js',
'assets/bower_components/velocity/velocity.js',
'assets/bower_components/velocity/velocity.ui.js',
'assets/bower_components/sticky/jquery.sticky.js',
'assets/bower_components/wow/dist/wow.js',
'assets/bower_components/flip/dist/jquery.flip.js',
'assets/bower_components/lazysizes/lazysizes.js',
'assets/bower_components/skrollr/src/skrollr.js',
'assets/bower_components/scrollReveal.js/scrollReveal.js',
//'assets/bower_components/lazy-line-painter/jquery.lazylinepainter-1.5.1.js',
//'assets/bower_components/flickity/dist/flickity.pkgd.js',
//'assets/bower_components/vide/dist/jquery.vide.js',
'assets/js/plugins/*.js',
//'assets/js/plugins.js',
'assets/js/_*.js'
];
grunt.initConfig({
jshint: {
options: {
jshintrc: '.jshintrc'
},
all: [
'Gruntfile.js',
'assets/js/*.js',
'!assets/js/scripts.js',
'!assets/**/*.min.*'
]
},
sass: {
dev: {
options: { // Target options
lineNumbers: false
//style: 'nested'
},
files: {
'assets/css/main.css': 'assets/sass/main.scss'
}
},
build: {
options: {
style: 'compressed',
sourcemap: 'none'
},
files: {
'assets/css/main.css': 'assets/sass/main.scss'
}
}
},
concat: {
options: {
separator: ';',
},
dist: {
src: [jsFileList],
dest: 'assets/js/scripts.js',
},
},
uglify: {
dist: {
files: {
'assets/js/scripts.js': [jsFileList]
}
}
},
autoprefixer: {
options: {
browsers: ['last 2 versions', 'ie 8', 'ie 9', 'android 2.3', 'android 4', 'opera 12']
},
dev: {
options: {
map: {
prev: 'assets/css/'
}
},
src: 'assets/css/main.css'
},
build: {
src: 'assets/css/main.css'
}
},
responsive_images: {
//engine: 'im',
options: {
sizes: [{
name: 'small',
width: 320,
quality: 100
}
//,{
//name: 'tablet',
//width: 720,
//quality: 100
//},{
//name: 'desktop',
//width: 940,
//quality: 100
//},{
//name: "largeDesktop",
//width: 1140,
//quality: 100
//},{
//name: "largeDesktopRetina",
//width: 2280,
//suffix: "_x2",
//quality: 100
//}
],
your_target: {
// Target-specific file lists and/or options go here.
}
},
files: [{
expand: true,
src: ['assets/**.{jpg,gif,png}'],
cwd: 'assets/images/',
dest: 'assets/images-min/'
//expand: true, // Enable dynamic expansion
//cwd: 'assets/images/', // Src matches are relative to this path
//src: ['assets/images/*.{png,jpg,gif,svg}'], // Actual patterns to match
////ext: '.min.js', // Dest filepaths will have this extension.
//dest: 'assets/images-min/' // Destination path prefix
}]
},
imagemin: {
dynamic: {
options: {
optimizationLevel: 7
},
files: [{
expand: true, // Enable dynamic expansion
cwd: 'assets/images/', // Src matches are relative to this path
src: ['**/*.{png,jpg,gif,svg}', '**/**/*.{png,jpg,gif,svg}', '*.{png,jpg,gif,svg}'], // Actual patterns to match
//ext: '.min.js', // Dest filepaths will have this extension.
dest: 'assets/images-min/' // Destination path prefix
}]
}
},
watch: {
sass: {
files: [
'assets/sass/*.scss',
'assets/sass/**/*.scss'
],
tasks: ['sass:dev', 'autoprefixer:dev']
},
js: {
files: [
jsFileList,
'<%= jshint.all %>'
],
tasks: ['jshint', 'concat']
},
livereload: {
//Browser live reloading
//https://github.com/gruntjs/grunt-contrib-watch#live-reloading
options: {
livereload: true
},
files: [
'assets/css/main.css',
'assets/js/scripts.js',
'assets/images/*',
'*.*'
]
}
}
//browserSync: {
//bsFiles: {
//src : 'assets/'
//},
//options: {
//watchTask: true,
//debugInfo: true,
//proxy: 'localhost:8888/landing-page/'
////host: "localhost", // use dev-ip to find a suitable IP
//}
//}
});
// Register tasks
grunt.registerTask('default', [
'dev'
]);
grunt.registerTask('dev', [
'browserSync',
'watch',
'newer:jshint',
'newer:sass:dev',
'newer:autoprefixer:dev',
'newer:responsive_images',
'newer:imagemin',
'newer:concat'
]);
grunt.registerTask('build', [
'jshint',
'sass:build',
'autoprefixer:build',
'imagemin',
'uglify'
]);
};
Probably an issue with your files definition.
src: ['assets/**.{jpg,gif,png}'],
cwd: 'assets/images/',
That's looking for .../assets/images/assets/.../x.jpg but I bet you meant:
src: ['**.{jpg,gif,png}'],
cwd: 'assets/images/',
Yes thanks, he wasn't clear the first time, thanks
hi, I got the same problem:
module.exports = function(grunt) {
grunt.initConfig({
responsive_images: {
dev: {
options: {
engine: 'im',
sizes: [{
width: 320,
height: 240
},{
name: 'medium',
width: 640
},{
name: "large",
width: 1024,
suffix: "_x2",
quality: 0.6
}]
},
files: [{
expand: true,
src: ['**.{gif,jpg,png}'],
cwd: 'images_src/',
dest: 'images/'
}]
}
},
/* Clear out the images directory if it exists */
clean: {
dev: {
src: ['images'],
},
},
mkdir: {
dev: {
options: {
create: ['images']
},
},
},
copy: {
dev: {
files: [{
expand: true,
src: 'images_src/fixed/*.{gif,jpg,png}',
dest: 'images/'
}]
},
},
});
grunt.loadNpmTasks('grunt-responsive-images');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-mkdir');
grunt.registerTask('default', ['responsive_images']);
};
This is my config.
Hi, I have this error, I installed the images tools too:
Warning: Command failed: gm identify: Unable to open file (undefined) [No such file or directory]. gm identify: Request did not return an image. Use --force to continue. Aborted due to warnings.
thx