Version and save assets in a remote repository.
npm install grunt-magpie> Version and save assets in a remote repository.
~0.4.5If 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:
``shell`
npm install grunt-magpie --save-dev
Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
`js`
grunt.loadNpmTasks('grunt-magpie');
to the data object passed into grunt.initConfig().`js
grunt.initConfig({
magpie: {
options: {
serverUrl: "http://my-magpie-server.com:8888",
versionedFilesMapPath: "my_versioned_files.json"
},
concat_all_the_things: {
options: {
tasks: ["concat:all_the_things"]
}
},
},
});
`$3
#### options.serverUrl
Type:
String
Default value: http://127.0.0.1:8888Location of the Magpie assets repository. Must have either
http or https before the URL.$3
Type: Array
Default value: falseAn array of tasks to download destination files from the repository (if possible), version and upload to the repository. The tasks are run in the order they are given in.
#### options.versionAfterBuild
Type:
Boolean
Default value: falseVersion the destination files _after_ the tasks listed in the
options.tasks array have completed. Use this for tasks like LESS complication (grunt-contrib-less) where the source files can include other files not listed explicitly in the task.#### options.versionedFilesMapPath
Type:
String
Default value: versioned_files.jsonPath to the file that will contain the mappings from the original destination paths to the versioned destination paths. This is used to avoid code updates for the new versioned asset path when they change.
#### options.versionedFilesMapTemplate
Type:
String
Default value: nullPath to an Underscore.js compatible template file. The array variable
mappings is passed into the data object for the template to use - it is an array of objects with the keys: hash, originalPath and versionedPath. This is used in combination with options.versionedFilesMapPath.$3
Type: Boolean
Default value: falseDon't download the file from the repository or run the associated task if the destination file exists.
$3
Type: Boolean
Default value: falseTreat the tasks array as a pipeline of tasks. A pipeline is defined as a series of tasks which need to run in their defined order to produce a single output file. An example of a pipeline would be many JavaScript files joined together using the
concat task, then the output of that task "uglified" with the uglify` task.