grunt-concat-seajs
If you combine a seajs project file, this task can be used with the seajs module to load the corresponding.
Getting Started
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-concat-seajs --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt;
The "concat_seajs" task
Overview
In your project's Gruntfile, add a section named concat_seajs
to the data object passed into grunt.initConfig()
.
grunt;
Options
baseDir
Type: String
Building the project then generate the destination path, fllowing this path is to find the file content for injecting the aim files.
seajs_src
Type: String
The path of seajs file is used to be the path of the match file.
map_file_name
Type: String
Default: fetch.js
This is the seajs fetch file name.
cdnBase
Type: String
If you static source put on the cdn service before you publish your project,you should config this param.
injectFetch
Type: Boolean
Default: false
Turns on injectFetch of the generated source code. the seajs fetch file will inject to the views which you config.
injectSea
Type: Boolean
Default: false
Turns on injectFetch of the generated source code. the seajs file will inject to the views which you config.
map
Type: Array
Default: []
Param: dest
, files
If you want to inject different js/css for individual pages, you can use this property,Any page can be configured individually.
Usage Examples
Custom Options
In this example, custom options are used to do something else with whatever else.
So if the concat
config concat the files and filerev
make files md5, the generated result would be genarate a match file in seajs_src
. At the same time, the match file would be insert to the view_src
.
grunt;
The most Important part
This is a very critical step!Please pay attention to this step. It's will need you to do some simple configuration in your pages: You have to separate the seajs.config part and the seajs.use part to two different