Import javascript dependencies and export to file. Like concat, but it's accept inline files.
Import javascript dependencies and export to file using NodeImport
. Like a concat plugin, but it's accept inline files.
So we don't need to define all files in grunt config, also not only append the next scripts into previous scripts.
We can import files even though the import statement is inside a function block function() {}
.
Since the basic function of NodeImport
is to execute scripts, you also can run scripts using this plugin, but it's not
a main function of this plugin.
Reads the NodeImport to find out how the import and export works.
This plugin requires Grunt ~0.4.5
and NodeImport ~0.1.3
.
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-export --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-export');
In your project's Gruntfile, add a section named exports
to the data object passed into grunt.initConfig()
.
grunt.initConfig({
exports: {
options: {
// Task options
},
your_target: {
// Target dir and files.
},
},
});
Type: Boolean
Default value: false
Execute scripts while exporting or not.
Type: Boolean
Default value: false
Execute scripts in synchronus mode.
Type: Boolean
Default value: true
Export imported scripts or just execute the scripts.
Type: Boolean
Default value: true
Export the minified version to file using UglifyJS.
Type: Object
Default value: null
Uglify options that will be passed to UglifyJS
Type: Boolean
Default value: true
Export the sourcemap to file.
Type: Boolean
Default value: false
Logs all activity.
In this example, task using default options and use verbose to logs all activity.
grunt.initConfig({
exports: {
test: {
options: {
verbose: true
},
files: {
'tmp': ['test/people.js'],
},
}
}
});
async
option."node-import
."