Plugin append require operator for js files, and build deps in html file. Simple and stupid.
This plugin requires Grunt ~0.4.5
If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:
npm install grunt-operator-require --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-operator-require');
In your project's Gruntfile, add a section named operator_require
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
operator_require: {
options: {
baseUrl: "/",
folder: "example/src/",
index: "index.js", //in example/src
dest: "example/index.html"
},
},
});
in your dest file (example/index.html) append lines
<!-- src -->
<!-- endsrc -->
Type: String
Default value: null
Main folder of app src files.
Type: String
Default value: null
App start point.
Type: String
Default value: null
App index file.
Type: String
Default value: '/'
Base url for file script include.
file index.js
//require test/Test.js
//require test/Test2.js
...
file test/Test.js
//require other/Test.js
...
build in index.html
...
<!-- src -->
<script type="javascript" src="example/src/other/Test.js"></script>
<script type="javascript" src="example/src/test/Test.js"></script>
<script type="javascript" src="example/src/test/Test2.js"></script>
<script type="javascript" src="example/src/index.js"></script>
<!-- endsrc -->
...
In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.
(Nothing yet)