Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

There is no way to preview your code #2

Open
0xR opened this issue Mar 29, 2015 · 1 comment
Open

There is no way to preview your code #2

0xR opened this issue Mar 29, 2015 · 1 comment

Comments

@0xR
Copy link

0xR commented Mar 29, 2015

There is no grunt task to make a bundle and no grunt serve task to view the html. This makes working with this generator not as good as it could be. Consider this a feature request.

@0xR
Copy link
Author

0xR commented Mar 29, 2015

I created a basic gruntfile with webpack bundeling and livereload support. No time to put this in a pull request yet, but here it is:

'use strict';
module.exports = function (grunt) {
  grunt.initConfig({
    eslint: {
      all: {
        src: [
          'src/**/*.js',
          '!src/**/*.rt.js'
        ]

      }
    },
    clean: {
      main: {
        src: ['./dist']
      }
    },
    copy: {
      html: {
        files: [{
          expand: true,
          cwd: 'src/',
          src: ['*.html'],
          dest: 'dist/'
        }]
      }
    },
    watch: {
      livereload: {
        options: {
          livereload: '<%= connect.options.livereload %>'
        },
        files: ['src/**/*.rt', 'src/**/*.html', 'src/**/*.js'],
        tasks: ['build']
      }
    },
    connect: {
      options: {
        port: 9000,
        hostname: '0.0.0.0',
        livereload: 35729,
        base: 'dist'
      },
      livereload: {
        open: true
      }
    },
    reactTemplates: {
      modules: 'commonjs',
      format: 'stylish',
      src: ['src/**/*.rt']
    },
    webpack: {
      dev: {
        resolve: {
          extensions: ['', '.js']
        },
        entry: './src/main.js',
        output: {
          path: './dist',
          filename: 'bundle.js'
        },
        stats: {
          colors: true
        },
        devtool: 'source-map'
      }
    }
  });

  grunt.loadNpmTasks('grunt-react-templates');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-contrib-clean');
  grunt.loadNpmTasks('grunt-contrib-copy');
  grunt.loadNpmTasks('grunt-contrib-connect');
  grunt.loadNpmTasks('grunt-eslint');
  grunt.loadNpmTasks('grunt-webpack');

  grunt.registerTask('test', ['eslint']);
  grunt.registerTask('build', ['clean', 'react-templates', 'copy:html', 'webpack']);
  grunt.registerTask('default', ['build', 'test']);

  grunt.registerTask('serve', ['build', 'connect', 'watch']);

};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant