Socket
Socket
Sign inDemoInstall

assets-expander

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assets-expander - npm Package Compare versions

Comparing version 0.4.1 to 0.5.0

.travis.yml

5

History.md

@@ -0,1 +1,6 @@

0.5.0 / 2012-09-06
==================
* Added ability to override stylesheets/javascripts directories via 'path' option to #processGroup method.
0.4.1 / 2012-08-07

@@ -2,0 +7,0 @@ ==================

2

lib/assets.js

@@ -89,3 +89,3 @@ var fs = require('fs'),

options.root = path.join(options.root, type);
options.root = path.join(options.root, localOptions.path || type);

@@ -92,0 +92,0 @@ var processLevel = function(levelDefinition, levelOptions) {

@@ -11,4 +11,7 @@ {

},
"version": "0.4.1",
"version": "0.5.0",
"main": "index.js",
"scripts": {
"test": "node_modules/.bin/vows test/*-test.js"
},
"devDependencies": {

@@ -15,0 +18,0 @@ "vows": "*"

@@ -0,1 +1,2 @@

[![build status](https://secure.travis-ci.org/GoalSmashers/assets-expander.png)](http://travis-ci.org/GoalSmashers/assets-expander)
## What is assets-expander? ##

@@ -16,3 +17,3 @@

expander.processGroup('stylesheets', 'public') // gets a flat list of assets in public group
### How to define assets.yml file? ###

@@ -25,3 +26,3 @@

- 'reset,shared,base,home'
Then if you have the following directory structure:

@@ -34,9 +35,9 @@

- home.css
executing the code above will get you a list of full paths to these 4 files:
['.../stylesheets/reset.css', '.../stylesheets/shared.css', '.../stylesheets/base.css', '.../stylesheets/home.css']
## License ##
Assets-expander is released under the MIT license.

@@ -9,16 +9,23 @@ var vows = require('vows'),

function fullPathTo(assetName) {
return path.join(rootPath, 'stylesheets', assetName + '.css');
function fullPathTo(assetName, stylesPath) {
stylesPath = stylesPath || 'stylesheets';
return path.join(rootPath, stylesPath, assetName + '.css');
};
function expand(list) {
return new AssetsExpander().processList(list, { root: path.join(rootPath, 'stylesheets'), type: 'css' });
var options = {
root: path.join(rootPath, 'stylesheets'),
type: 'css'
}
return new AssetsExpander().processList(list, options);
};
function expanderFor(name) {
return new AssetsExpander(path.join(process.cwd(), 'test', 'assets', name), { root: rootPath });
var yamlFilePath = path.join(process.cwd(), 'test', 'assets', name);
return new AssetsExpander(yamlFilePath, { root: rootPath });
};
function group(groupId) {
return expanderFor('assets.yml').processGroup('stylesheets', groupId, { type: 'css' });
return expanderFor('assets.yml')
.processGroup('stylesheets', groupId, { type: 'css' });
};

@@ -41,2 +48,5 @@

// Tests expanding various assets definitions,
// e.g. '*', 'one,two', 'path/**/*', 'path/[one,two]'.
// It is based on files in ./assets/stylesheets directory.
exports.listsSuite = vows.describe('expanding assets').addBatch({

@@ -155,2 +165,3 @@ 'expand empty': {

// Tests expanding real definitions from *.yml files
exports.groupsSuite = vows.describe('expanding assets groups').addBatch({

@@ -225,2 +236,15 @@ 'expand unknown type': {

}
},
'expanding all from custom.yml (with custom path)': {
topic: function() {
return expanderFor('custom.yml')
.processGroup('stylesheets', 'all', { type: 'css', path: './css' });
},
'should give one asset': function(expanded) {
assert.equal(expanded.length, 2);
},
'should give one.css only': function(expanded) {
assert.equal(expanded[0], fullPathTo('one', 'css'));
assert.equal(expanded[1], fullPathTo('two', 'css'));
}
}

@@ -227,0 +251,0 @@ });

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc