-
Notifications
You must be signed in to change notification settings - Fork 358
Open
Description
Since a year has passed without an answer, I create a new issue:
I use grunt watch with the following modules to minify the code in my website:
- grunt-contrib-uglify
- grunt-contrib-compass
- grunt-contrib-htmlmin
Everytime I launch grunt watch
and modify some file, i got this error:
Fatal error: Cannot read property 'files' of undefined
Even with grunt watch --verbose
I don't get any other useful info than the error
If I launch the tasks separately (eg. grunt uglify
) they work with no problems.
Here's the package.json:
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
htmlmin: {
build: {
options: {
removeComments: true,
collapseWhitespace: true,
ignoreCustomFragments: [
/\{\{[\s\S](.*?)\}\}/,
/\{\%[\s\S](.*?)\%\}/,
/<\?[\s\S]*?\?>/
]
},
files: [
{
expand: true,
cwd: 'dev/html/layout',
src: ['*.html'],
dest: 'theme/layout',
ext: '.liquid',
extDot: 'last'
},
{
expand: true,
cwd: 'dev/html/snippets',
src: ['*.html'],
dest: 'theme/snippets',
ext: '.liquid',
extDot: 'last'
},
{
expand: true,
cwd: 'dev/html/templates',
src: ['*.html'],
dest: 'theme/templates',
ext: '.liquid',
extDot: 'last'
}
]
}
},
uglify: {
options: {
mangle: false,
//banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */'
},
dest: {
files: {
'theme/assets/vendors.min.js': [
'dev/js/vendor/jquery.min.js',
'dev/js/vendor/bootstrap.min.js',
'dev/js/vendor/jquery.scrollto.js',
'dev/js/vendor/owl.carousel.min.js',
'dev/js/vendor/waypoint.min.js'
],
'theme/assets/function-data.min.js.liquid': [ 'dev/js/function-data.js' ],
'theme/assets/function-effect.min.js.liquid': [ 'dev/js/function-effect.js' ],
'theme/assets/related-items.min.js.liquid': [
'dev/js/related-items.js'
],
'theme/assets/function-countries.min.js.liquid': [
'dev/js/function-countries.js'
]
}
}
},
compass: {
dist: {
options: {
config: 'compass.rb',
outputStyle: 'compressed',
environment: 'production',
specify: [
'dev/scss/account.scss',
'dev/scss/cart.scss',
'dev/scss/checkout.scss',
'dev/scss/collections.scss',
'dev/scss/home.scss',
'dev/scss/landings.scss',
'dev/scss/main.scss',
'dev/scss/page-freelancer.scss',
'dev/scss/page-shop-instagram.scss',
'dev/scss/page-special-collection01.scss',
'dev/scss/page-static.scss',
'dev/scss/page-weddings.scss',
'dev/scss/product.scss',
'dev/scss/referral.scss'
],
relativeAssets: false,
noLineComments: false,
sourcemap: false
}
}
},
watch: {
sass: {
files: ['dev/scss/**'],
tasks: ['compass']
},
js: {
files: ['dev/js/**'],
tasks: ['uglify']
},
html: {
files: ['dev/html/**'],
tasks: ['htmlmin']
}
}
});
// Load the plugins that provides the tasks.
grunt.loadNpmTasks('grunt-contrib-htmlmin');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-watch');
// Default task(s).
grunt.registerTask('default', ['watch']);
grunt.registerTask('build', ['compass','uglify','htmlmin']);
};
Here's the environment I'm working with:
MacOS 10.12.6
[email protected]
[email protected]
Metadata
Metadata
Assignees
Labels
No labels