I'm pretty new to grunt / npm, but after reading the docs. I made myself package.jsonand Gruntfile.js. Here is my folder structure:
/
|- src
|- myfile.es6
|- anotherfile.es6
|- etc.
|- Gruntfile.js
|- package.json
What i have
Here's mine Gruntfile:
module.exports = function(grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
babel: {
options: {
sourceMap: true,
plugins: ['es2015']
},
dist: {
files: [{
expand: true,
cwd: 'src/',
src: ['*.es6'],
dest: 'dist/',
ext: '.js'
}]
}
}
});
grunt.registerTask('default', ['babel'])
};
And here is mine package.json:
{
"name": "Cheddar",
"version": "0.2.0",
"devDependencies": {
"babel-preset-es2015": "^6.6.0",
"grunt": "^1.0.1",
"grunt-babel": "^6.0.0"
},
"scripts": {
"test": "grunt --verbose"
}
}
What is he doing?
I have my folder src/that contains my source files ( *.es6). I want to translate them into a directory dist/using grunt.
What i tried
Then I installed all the dependencies / babel-cli / grunt-cli / etc. using npm installandnpm-update --save
It seems good, so I went ahead and ran to grunt:
$ grunt
Running "babel:dist" (babel) task
Done.
$ ls
Gruntfile.js node_modules/ package.json src/
ls , , grunt. . dist? . babelify , , , .