Answer the question
In order to leave comments, you need to log in
Newbie problem with Grunt, what's wrong with Gruntfile.js?
Hello everybody. I came to Grunt for reasons of speeding up work, but so far it only slows me down, and it’s decently so. Such a task - Watch tracks changes in an array of files, when one of them changes, Concat combines them into one style.scss, Watch, in turn, tracks changes in style.scss and Sass converts it to style.css. But at the same time, the grunt command in the terminal returns:
Gruntfile.js:27
watch: {
^^^^^
Loading "Gruntfile.js" tasks...ERROR
>> SyntaxError: Unexpected identifier
Warning: Task "default" not found. Use --force to continue.
Aborted due to warnings.
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
dist: {
src: [
'styles/adress-map.scss',
'styles/header.scss',
'styles/variables.scss',
'styles/about.scss',
'styles/sunglasses.scss',
'styles/call.scss',
'styles/form.scss',
'styles/icons.scss',
'styles/shari.scss',
'styles/nav.scss',
'styles/grid.scss'
],
dest: 'styles/style.scss',
}
}
watch: {
css: {
files: ['styles/style.scss'],
tasks: ['sass'],
options: {
spawn: false,
}
}
scss: {
files: [
'styles/adress-map.scss',
'styles/header.scss',
'styles/variables.scss',
'styles/about.scss',
'styles/sunglasses.scss',
'styles/call.scss',
'styles/form.scss',
'styles/icons.scss',
'styles/shari.scss',
'styles/nav.scss',
'styles/grid.scss'
],
tasks: ['concat'],
options: {
spawn: false,
}
}
}
sass: {
dist: {
options: {
style: 'compressed'
},
files: [
'styles/style.css': 'styles/style.scss'
],
}
}
};
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('default', ['watch', 'sass', 'concat']);
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question