grunt-blobify v0.1.1
grunt-blobify 
Grunt task to convert any files to Blob for usage in browser
Getting Started
This plugin requires Grunt >=0.4.0
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-blobify --save-devOnce the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
grunt.loadNpmTasks('grunt-blobify');Blobify task
options
target
Type: String. Values: es6, global. Default: es6.
Compiles result of task as:
es6 - export default {...};
global - window.files = {};
targetNamespace
Type: String. Default: window. Namespace for global target.
Examples
global target
blobify: {
main: {
options: {
target: 'global',
targetNamespace: 'myApp.cache'
},
src: [
'/YOUR_PATH/*.png',
'/YOUR_PATH2/*.docx'
],
dest: 'YOUR_PATH/filesCache.js'
}
}After running grunt blobify:main we will have in 'YOUR_PATH/filesCache.js':
....
myApp.cache.files = {
'/YOUR_PATH/*.png': {Blob},
'/YOUR_PATH2/*.docx': {Blob}
};ES6 target
blobify: {
main: {
options: {
target: 'es6' //or you may remove options, target has 'es6' value by default
},
src: [
'/YOUR_PATH/*.png',
'/YOUR_PATH2/*.docx'
],
dest: 'YOUR_PATH/filesCache.js'
}
}After running grunt blobify:main we will have in 'YOUR_PATH/filesCache.js':
....
var files = {
'/YOUR_PATH/*.png': {Blob},
'/YOUR_PATH2/*.docx': {Blob}
};
....
exports default files;