I have the following files for the GruntJS configuration and thus pass my js files to js.min files
The package.json file:
{
"name": "grunt-primerospasos",
"version": "1.0.0",
"description": "Descripcion de mi primer proyecto en gruntjs",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://gitlab.com/jggj/grunt-primerospasos.git"
},
"keywords": [
"gruntJS"
],
"author": "jggarcia",
"license": "ISC",
"bugs": {
"url": "https://gitlab.com/jggj/grunt-primerospasos/issues"
},
"homepage": "https://gitlab.com/jggj/grunt-primerospasos#README",
"devDependencies": {
"grunt": "^1.0.1",
"grunt-contrib-uglify": "^3.1.0"
},
"dependencies": {
"grunt-contrib-uglify": "^3.1.0",
"grunt": "^1.0.1"
}
}
and the Gruntfile.js file, like this:
module.exports = function (grunt) {
//Configuraciones del proyecto
grunt.initConfig({
//Conf Uglify
uglify: {
options: {
mangle: false,
compress: {
drop_console: true
}
},
js: {
files:[{
cwd: 'js/src/', //ruta de nuestro javascript fuente
expand: true, //ingresar a las subcarpetas
src: '*.js' //patrón relativo a cwd
dest: 'js/min/' //destino de los archivos compresos, minificados
}]
}
}
});
//Cargar grunt-contrib-uglify (plugin)
grunt.loadNpmTasks('grunt-contrib-uglify');
//Registrar la tarea default, esta ejecutara la tarea grunt uglify
grunt.registerTask('default',['uglify']);
};
When I run the npm run grunt default command it gives me the following error:
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
npm ERR! node v6.11.3
npm ERR! npm v3.10.10
npm ERR! missing script: start
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! C:\xampp\htdocs\grunt-primerospasos\npm-debug.log
and in the end I can not convert my js files to minified ones. What could be my mistake?