Skip to content
This repository has been archived by the owner on Dec 20, 2017. It is now read-only.

Commit

Permalink
Merge branch 'refactor/split'
Browse files Browse the repository at this point in the history
  • Loading branch information
jgallen23 committed Aug 10, 2012
2 parents bcf0bf6 + ae315f0 commit 0d848f5
Show file tree
Hide file tree
Showing 69 changed files with 916 additions and 2,896 deletions.
42 changes: 42 additions & 0 deletions History.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,46 @@

0.5.0 / 2012-08-10
==================

* added blank readme
* removed old examples
* print out size of file
* be able to force filename with filename option
* fixed test so path.existsSync warning wouldn't get called
* removed nib support
* throw if minification fails, need to fix in resistance

0.5.0alpha4 / 2012-08-03
==================

* read stylus imports when watching files

0.5.0alpha3 / 2012-08-03
==================

* fixed issues with cli args and passing in config file
* remove <feff>

0.5.0alpha2 / 2012-08-01
==================

* added watch support
* able to override config file with arguments passed in
* refactored preprocessors a little

0.5.0alpha1 / 2012-07-25
==================

* froze deps, fixed test
* cli
* pass in config file, separated out mash.js and set.js
* removed console-trace from unit tests
* removed unused deps
* able to pass in array of objects, changed return to be an object
* make test
* complete rewrite, added tests
* nib support

0.4.2 / 2012-06-29
==================

Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
test:
./node_modules/.bin/mocha --ui tdd

.PHONY: test
48 changes: 0 additions & 48 deletions bin/masher

This file was deleted.

133 changes: 133 additions & 0 deletions bin/masher.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
#!/usr/bin/env node
var aug = require('aug');
var masher = require('../');
var config = require('../lib/config');
var defaults = require('../lib/defaults');
var size = require('../lib/utils/size');
var fs = require('fs');
var findImports = require('../lib/utils/find-imports');

var version = JSON.parse(fs.readFileSync(__dirname + '/../package.json', 'utf8')).version

var opt = require('optimist')
.usage('Masher '+version+'\n$0 [opts] <config>')
.options('n', {
alias: 'name',
describe: 'Name of file',
default: defaults.name
})
.options('f', {
alias: 'files',
describe: 'List of files to mash [file.js,file.js,file.js]',
type: 'string'
})
.options('m', {
alias: 'minify',
describe: 'Minify/compress files',
type: 'boolean',
default: defaults.minify
})
.options('a', {
alias: 'hash',
describe: 'Append hash to filename',
default: defaults.hash,
type: 'boolean'
})
.options('v', {
alias: 'version',
describe: 'Append version to filename',
default: defaults.version,
type: 'string'
})
.options('o', {
alias: 'out',
describe: 'Output directory',
default: process.cwd()
})
.options('w', {
alias: 'watch',
describe: 'Watch files for changes',
default: false,
type: 'boolean'
})
.options('h', {
alias: 'help',
descripe: 'Show help info'
})

var argv = opt.argv

if (argv.help) {
return opt.showHelp();
}

//watch functionality
var watch = function(arrObj) {

var timeout;

var watchFile = function(obj, file) {
fs.watch(file, function() {
if (timeout) {
clearTimeout(timeout)
}
timeout = setTimeout(function() {
console.log('---');
console.log('File Changed: '+file);
console.log('');
mash([obj]);

//re-watch
setTimeout(function() {
watchFile(obj, file);
}, 100);
}, 700);
});
}

var watchObj = function(obj) {
obj.files.forEach(function(item) {
console.log('Watching '+item);
watchFile(obj, item);
findImports(item, function(err, imports) {
imports.forEach(function(file) {
console.log('Watching '+file);
watchFile(obj, file);
});
});
});
}
arrObj.forEach(watchObj);

argv.watch = false;

}

var mash = function(obj) {
masher(obj, function(err) {
if (err) {
throw err;
}
console.log('Mashed:');
for (var i = 1, c = this.length; i < c; i++) {
var item = this[i];
console.log('%s (%skb)', item.filename, size(item.source));
}
});
if (argv.watch) {
watch(obj);
}
}
if (argv.files) {
argv.files = argv.files.split(',');
}

if (argv._.length != 0) {
config(argv._[0], argv, function(err, arrObj) {
mash(arrObj);
});
} else {
var obj = aug(true, {}, defaults, argv);
mash([obj]);
}

44 changes: 0 additions & 44 deletions example/express/masher.json

This file was deleted.

2 changes: 0 additions & 2 deletions example/express/public/ui/scripts/app.js

This file was deleted.

Loading

0 comments on commit 0d848f5

Please sign in to comment.