Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module.exports = function(grunt) {
- // run it wit grunt stoyan in the root of the project
- grunt.registerTask('stoyan', function(){
- console.log('Hello World from grunt!');
- });
- // grunt speak
- grunt.registerTask('speak', function(){
- console.log('I am speaking!');
- });
- // grunt both
- grunt.registerTask('both', ['stoyan', 'speak']);
- // grunt
- grunt.registerTask('default', ['stoyan', 'speak']);
- // in order to run concat you will need to run npm
- // npm install grunt-contrib-concat --save-dev
- /* https://github.com/gruntjs/grunt-contrib-concat
- // Project configuration.
- grunt.initConfig({
- concat: {
- options: {
- separator: ';',
- },
- dist: {
- src: ['src/intro.js', 'src/project.js', 'src/outro.js'],
- dest: 'dist/built.js',
- },
- },
- });
- */
- // Project configuration.
- grunt.initConfig({
- pkg: grunt.file.readJSON('package.json'), // you can use the pkg object
- concat: {
- options: {
- stripBanners: true,
- banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - ' +
- '<%= grunt.template.today("yyyy-mm-dd") %> */',
- },
- dist: { // run with -> grunt concat:dist
- src: ['src/project.js'],
- dest: 'dist/built.js',
- },
- happy: { // run with -> grunt concat:happy
- src: ['src/project.js'],
- dest: 'build/scripts.js',
- },
- js: { // run with -> grunt concat:dist
- src: ['src/js/main.js'],
- dest: 'build/js/scripts.js',
- },
- css: { // run with -> grunt concat:happy
- src: ['src/css/style.js'],
- dest: 'build/css/styles.js',
- },
- },
- watch: {
- js: {
- // files: '**/*.js',
- files: 'src/**/*.js',
- // tasks: ['jshint'],
- tasks: ['concat:js'], // whatever happens in the js files run concat
- options: {
- interrupt: true,
- },
- },
- css: {
- // files: '**/*.js',
- files: 'src/**/*.css',
- // tasks: ['jshint'],
- tasks: ['concat'], // whatever happens in the js files run concat
- options: {
- interrupt: true,
- },
- },
- },
- });
- // Run this task with the grunt concat command
- grunt.loadNpmTasks('grunt-contrib-concat');
- // grunt watch
- grunt.loadNpmTasks('grunt-contrib-watch');
- // https://github.com/gruntjs/grunt-contrib-connect - very interstung as well
- // https://www.npmjs.com/package/grunt-contrib-uglify
- // grunt.registerTask('default', ['concat', 'watch']);
- };
Advertisement
Add Comment
Please, Sign In to add comment