Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
build js and embed required.
JavaScript
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib
tasks
templates
.gitignore
README.md
package.json

README.md

grunt-embed-require

build js and embed required.

example

// Gruntfile.js

module.exports = function(grunt) {
    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        embed_require: {
            dev: {
                src: 'src/js',
                dest: 'js'
            }
        }
    });

    grunt.loadNpmTasks('grunt-embed-require');

    grunt.registerTask('build', ['embed_require:dev']);

    grunt.registerTask('default', ['build']);
};
// src/js/main.js

var MyModule = require('MyModule'),
    $ = require('lib/jquery');

$(function () {
    new MyModule('hoge');
});
// src/js/MyModule.js

var MyModule = function (name) {
    this.name = name;
};

MyModule.prototype.hello = function () {
    return this.name;
};

module.exports = MyModule;
Something went wrong with that request. Please try again.