Comparing version 0.1.0 to 0.1.1
@@ -134,2 +134,8 @@ /*jshint camelcase:false */ | ||
dest: 'temp/bundles/amd.js' | ||
}, | ||
testCaseCommonJS: { | ||
options: { | ||
commonjs: true, | ||
}, | ||
dest: 'temp/bundles/commonjs.js' | ||
} | ||
@@ -232,2 +238,3 @@ | ||
'assetsBundle:testCaseAMD', | ||
'assetsBundle:testCaseCommonJS', | ||
'assetsReplace:testCase', | ||
@@ -234,0 +241,0 @@ 'assetsReplace:testCasePrepend', |
@@ -128,2 +128,7 @@ /** | ||
if (this.options.commonjs) { | ||
script += 'module.exports=assets;' + nl; | ||
exported = true; | ||
} | ||
if (this.options.ns) { | ||
@@ -130,0 +135,0 @@ var parts = this.options.ns.split('.'); |
{ | ||
"name": "assetflow", | ||
"description": "Asset deployment for node", | ||
"version": "0.1.0", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/verbling/assetflow", | ||
@@ -43,4 +43,6 @@ "author": "Verbling", | ||
"async": "~0.2.6", | ||
"config": "~0.4.20", | ||
"timely": "0.0.1", | ||
"pace": "0.0.4" | ||
"pace": "0.0.4", | ||
"yaml": "~0.2.3" | ||
}, | ||
@@ -52,3 +54,2 @@ "devDependencies": { | ||
"grunt-contrib-watch": "~0.2.0", | ||
"config": "~0.4.20", | ||
"grunt-contrib-clean": "~0.4.0" | ||
@@ -55,0 +56,0 @@ }, |
# assetflow | ||
Assetflow is an asset deployment tool for node. It enables you to create powerful asset flows easily and fast. | ||
Assetflow is an asset deployment tool. It supports md5 hash comparison with **S3** and enables you to create powerful asset flows easily and fast. It is a [Grunt task][grunt] and applies solid cache-busting techniques transparently. | ||
Assetflow is a [Grunt task][grunt] and works with **S3** out of the box. It will take care of versioning and apply solid cache-busting techniques transparently. | ||
> If you are not familiar with Grunt check out the [Grunt's Getting Started guide][Getting Started]. | ||
[![Build Status](https://travis-ci.org/verbling/assetflow.png?branch=master)](https://travis-ci.org/verbling/assetflow) | ||
## Overview | ||
@@ -24,3 +24,3 @@ | ||
## Quick Start | ||
## Install | ||
@@ -31,31 +31,10 @@ ```shell | ||
Open your [Gruntfile][] and add the following config: | ||
## Table Of Contents | ||
```js | ||
assets: { | ||
options: { | ||
manifest: 'temp/manifest.json', | ||
}, | ||
all: { | ||
src: ['assets/**'], | ||
dest: 'temp/assets' | ||
}, | ||
}, | ||
assetsS3: { | ||
options: { | ||
checkS3Head: true, | ||
manifest: 'temp/manifest.json', | ||
key: config.aws_key, | ||
secret: config.aws_secret, | ||
bucket: config.aws_static_bucket, | ||
access: 'public-read', | ||
}, | ||
target: { | ||
upload: { | ||
src: 'temp/assets/**', | ||
dest: 'assets/' | ||
} | ||
} | ||
} | ||
``` | ||
* [Grunt Task `assets`](#grunt-task-assets) :: Creates the manifest file and copies your assets to a temp folder. | ||
* [Grunt Task `assetsReplace`](#grunt-task-assetsreplace) :: Replaces defined keywords in files using the manifest file. | ||
* [Grunt Task `assetsBundle`](#grunt-task-assetsbundle) :: Create a front-end optimized manifest file. | ||
- [Using assetflow on the web](#using-assetflow-on-the-front-end) | ||
* [Grunt Task `assetsS3`](#grunt-task-assetss3) :: Compare assets' hashes with S3 and upload new and changed files. | ||
* [Using Assetflow on Node](#using-assetflow-on-node) | ||
@@ -188,2 +167,3 @@ ## Grunt Task `assets` | ||
``` | ||
<sup>[↑ Back to TOC](#table-of-contents)</sup> | ||
@@ -292,2 +272,3 @@ ## Grunt Task `assetsReplace` | ||
``` | ||
<sup>[↑ Back to TOC](#table-of-contents)</sup> | ||
@@ -310,2 +291,7 @@ ## Grunt Task `assetsBundle` | ||
#### `commonjs` | ||
**Type**: `boolean` **Default**: `false` | ||
export the assets using commonjs pattern. e.g: module.exports=.. | ||
#### `ns` | ||
@@ -370,2 +356,4 @@ **Type**: `string` **Default**: `ASSETS` | ||
<sup>[↑ Back to TOC](#table-of-contents)</sup> | ||
## Grunt Task `assetsS3` | ||
@@ -494,7 +482,39 @@ | ||
``` | ||
<sup>[↑ Back to TOC](#table-of-contents)</sup> | ||
## Using Assetflow on Node | ||
You can use the Assetflow library on node: | ||
```js | ||
// mind the () in the end! | ||
var assets = require('assetflow')(); | ||
assets.config({ | ||
manifest: __dirname + '/assetManifest.json' | ||
}); | ||
var assetUrl = assets.asset('/img/logo.png'); | ||
``` | ||
> Like the client API, node's API is weak and may change in the future. | ||
<sup>[↑ Back to TOC](#table-of-contents)</sup> | ||
## Authors | ||
* [@thanpolas][thanpolas] | ||
## Release History | ||
- **v0.1.1**, *19 March 2013* | ||
- Added support for commonjs for browsers. | ||
- **v0.1.0**, *Mid March 2013* | ||
- Big Bang | ||
## License | ||
Copyright 2012 Verbling (Fluency Forums Corporation) | ||
Licensed under the MIT License | ||
[grunt]: http://gruntjs.com/ | ||
@@ -507,1 +527,2 @@ [Getting Started]: https://github.com/gruntjs/grunt/wiki/Getting-started | ||
[erickrdch]: https://github.com/erickrdch "Erick Ruiz de Chavez on GitHub" | ||
[thanpolas]: https://github.com/thanpolas "Thanasis Polychronakis" |
@@ -23,7 +23,23 @@ /** | ||
var compareObj = function(actualObj, expectedObj) { | ||
for (var asset in actualObj) { | ||
if ('__conf__' === asset) { | ||
continue; | ||
} | ||
for (var prop in asset) { | ||
if ('mtime' === prop) { | ||
continue; | ||
} | ||
assert.equal(actualObj[asset][prop], expectedObj[asset][prop], | ||
'Manifest asset "' + asset + '" should have same properties as expected'); | ||
} | ||
} | ||
}; | ||
it('should produce the correct manifest json file', function(){ | ||
var actualFile = 'testManifest.json'; | ||
var actual = grunt.file.read(tmp + actualFile); | ||
var expected = grunt.file.read(expectedPath + actualFile); | ||
assert.equal(actual, expected, 'task output should equal: ' + actualFile); | ||
var actualObj = grunt.file.readJSON(tmp + actualFile); | ||
var expectedObj = grunt.file.readJSON(expectedPath + actualFile); | ||
compareObj(actualObj, expectedObj); | ||
}); | ||
@@ -33,5 +49,6 @@ | ||
var actualFile = 'testManifestAbs.json'; | ||
var actual = grunt.file.read(tmp + actualFile); | ||
var expected = grunt.file.read(expectedPath + actualFile); | ||
assert.equal(actual, expected, 'task output should equal: ' + actualFile); | ||
var actualObj = grunt.file.readJSON(tmp + actualFile); | ||
var expectedObj = grunt.file.readJSON(expectedPath + actualFile); | ||
compareObj(actualObj, expectedObj); | ||
}); | ||
@@ -38,0 +55,0 @@ it('should return the proper asset value', function() { |
@@ -34,2 +34,8 @@ /** | ||
}); | ||
it('should produce the correct bundle file with commonjs export option', function(){ | ||
var actualFile = 'commonjs.js'; | ||
var actual = grunt.file.read(tmp + actualFile); | ||
var expected = grunt.file.read(expectedPath + actualFile); | ||
assert.equal(actual, expected, 'task output should equal: ' + actualFile); | ||
}); | ||
it('should produce the correct bundle file with namespace export option', function(){ | ||
@@ -36,0 +42,0 @@ var actualFile = 'namespace.js'; |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
760377
5
45
10259
521
13
+ Addedconfig@~0.4.20
+ Addedyaml@~0.2.3
+ Addedconfig@0.4.37(transitive)
+ Addedyaml@0.2.3(transitive)