Skip to content

Instantly share code, notes, and snippets.

@rchrd2
Created May 4, 2016 01:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rchrd2/7732154c40dcf92e7084f76db4cf341b to your computer and use it in GitHub Desktop.
Save rchrd2/7732154c40dcf92e7084f76db4cf341b to your computer and use it in GitHub Desktop.
Example gruntfile for react
module.exports = function(grunt) {
grunt.initConfig({
watch: {
files: [
'src/**/*.js',
'src/**/*.jsx'
],
tasks: ['browserify']
},
browserify: {
dist: {
options: {
transform: [
['babelify', {presets: ['es2015', 'react']}]
]
},
src: ['src/app.js'],
dest: 'build/app.build.js',
}
},
});
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-browserify');
grunt.registerTask('default', ['browserify']);
};
{
"name": "grunt-example",
"version": "1.0.0",
"description": "Grunt example",
"main": "index.js",
"dependencies": {},
"devDependencies": {
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babelify": "7.3.0",
"grunt": "^1.0.1",
"grunt-babel": "^6.0.0",
"grunt-browserify": "5.0.0",
"grunt-contrib-watch": "^1.0.0"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"Internet",
"Archive"
],
"author": "Richard Caceres",
"license": "AGPL-3.0"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment