I'm setting up grunt minification tasks for the following css file named "test.css":
body{
background-color: #fff;
text-align: left;
}
I get the following message when I run grunt
:
WARN: ERROR: Unexpected token: punc ({) [test.css:1,4]
My "Gruntfile.js" file currently looks like this:
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
uglify: {
options: {
banner: '/*! <%= pkg.name %> <%= grunt.template.today("yyyy-mm-dd") %> */\n'
},
min: {
src: 'test.css',
dest: 'test.min.css'
}
}
});
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.registerTask('default', ['uglify']);
};
My "package.json" file currently looks like this:
{
"name": "kaidez",
"version": "0.1.0",
"devDependencies": {
"grunt": "~0.4.0",
"grunt-contrib-uglify": "~0.1.1"
}
}
Running grunt v4.0 and node v0.8.20, both installed globally. Both grunt-cli
and uglify
are installed. "Gruntfile.js", "package.json" and "test.css" are in the same directory. All of these files are in the "themes" directory for a WordPress site, but I don't that's the issue.
Any ideas?
The uglify task is only for JavaScript files. For CSS, checkout this answer, which suggests grunt-css (cit Jonathan Lonowski comment)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With