Skip to content
build js and embed required.
JavaScript
Find file
Latest commit 86f1dbc Fujisawa Shin READMEと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.