Skip to content

Instantly share code, notes, and snippets.

@skullbulb
Last active August 29, 2015 14:07

Revisions

  1. skullbulb revised this gist Oct 7, 2014. 1 changed file with 3 additions and 1 deletion.
    4 changes: 3 additions & 1 deletion gruntfile.js
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,9 @@ module.exports = function(grunt) {
    src: 'src/js/application.js',
    dest: 'dist/js/application.js',
    options: {
    debug: true
    browserifyOptions: {
    debug: true
    },
    external: [
    'handlebars', 'underscore', 'jquery', 'backbone', 'backbone.marionette'
    ]
  2. skullbulb revised this gist Oct 7, 2014. 1 changed file with 3 additions and 2 deletions.
    5 changes: 3 additions & 2 deletions LayoutView.js
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,10 @@
    var Marionette = require('backbone.marionette');
    var Marionette = require('backbone.marionette'),
    _ = require('underscore'); // return lodash instance

    module.exports = Marionette.LayoutView.extend({

    initialize: function () {
    console.log('Hellow World');
    console.log('Lodash version', _.VERSION);
    }

    });
  3. skullbulb created this gist Oct 7, 2014.
    9 changes: 9 additions & 0 deletions LayoutView.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    var Marionette = require('backbone.marionette');

    module.exports = Marionette.LayoutView.extend({

    initialize: function () {
    console.log('Hellow World');
    }

    });
    3 changes: 3 additions & 0 deletions application.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,3 @@
    var LayoutView = require('./views/LayoutView.js');

    new LayoutView();
    46 changes: 46 additions & 0 deletions gruntfile.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    module.exports = function(grunt) {

    grunt.initConfig({

    pkg: grunt.file.readJSON('package.json'),

    browserify: {
    vendor: {
    src: 'src/js/vendor.js',
    dest: 'dist/js/vendor.js',
    options: {
    alias: [
    './node_modules/handlebars/runtime.js:handlebars',
    './node_modules/lodash/dist/lodash.underscore.js:underscore',
    'jquery:',
    'backbone:',
    'backbone.marionette:'
    ]
    }
    },
    application: {
    src: 'src/js/application.js',
    dest: 'dist/js/application.js',
    options: {
    debug: true
    external: [
    'handlebars', 'underscore', 'jquery', 'backbone', 'backbone.marionette'
    ]
    }
    }
    },

    watch: {
    scripts: {
    files: 'src/js/**/*.js',
    tasks: ['browserify:application'],
    }
    }

    });

    grunt.loadNpmTasks('grunt-contrib-watch');
    grunt.loadNpmTasks('grunt-browserify');

    grunt.registerTask('default', ['browserify:vendor', 'browserify:application', 'watch']);
    };
    22 changes: 22 additions & 0 deletions package.json
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,22 @@
    {
    "name": "sample",
    "version": "1.0.0",
    "description": "Your Application",
    "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
    },
    "author": "",
    "license": "ISC",
    "devDependencies": {
    "grunt": "^0.4.5",
    "grunt-browserify": "^3.0.1",
    "grunt-contrib-watch": "^0.6.1"
    },
    "dependencies": {
    "backbone": "^1.1.2",
    "handlebars": "^2.0.0",
    "jquery": "^2.1.1",
    "lodash": "^2.4.1",
    "backbone.marionette": "^2.2.1"
    }
    }
    1 change: 1 addition & 0 deletions vendor.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    require('backbone').$ = require('jquery');