Comparing version 0.3.2 to 0.3.3
@@ -72,5 +72,8 @@ var Minifyify | ||
// as they might convert non-js files into js | ||
_.each(opts.transforms, function (transform) { | ||
copyStream = copyStream.pipe(transform(source)); | ||
}); | ||
// with the exception of JSON files (package.json) | ||
if(path.extname(source).toLowerCase() !== '.json') { | ||
_.each(opts.transforms, function (transform) { | ||
copyStream = copyStream.pipe(transform(source)); | ||
}); | ||
} | ||
@@ -188,6 +191,2 @@ copyStream.pipe( opts.minifier ? minifyingThrough : noopThrough ) | ||
_.each(opts.transforms, function (transform) { | ||
newBundle.transform(transform); | ||
}); | ||
newBundle.bundle({debug:true}, function (err, data) { | ||
@@ -194,0 +193,0 @@ if(err) throw err; |
@@ -14,3 +14,3 @@ { | ||
], | ||
"version": "0.3.2", | ||
"version": "0.3.3", | ||
"repository": { | ||
@@ -22,2 +22,3 @@ "type": "git", | ||
"dependencies": { | ||
"browserify": "https://github.com/ben-ng/node-browserify/archive/master.tar.gz", | ||
"concat-stream": "1.0.x", | ||
@@ -37,6 +38,7 @@ "through": "2.3.x", | ||
"devDependencies": { | ||
"browserify": "https://github.com/ben-ng/node-browserify/archive/master.tar.gz", | ||
"jquery-browserify": "latest", | ||
"jake": "latest", | ||
"backbone": "1.0.x", | ||
"hbsfy": "0.1.x", | ||
"envify": "0.1.x", | ||
"handlebars-runtime": "1.0.x" | ||
@@ -43,0 +45,0 @@ }, |
@@ -13,3 +13,3 @@ Minifyify | ||
There is an issue in `browserify` that results in broken sourcemaps. [Use my patched fork](https://github.com/ben-ng/node-browserify) until the PR gets merged. | ||
Browserify does not preserve the `source` key when combining source maps, which will cause minifyify to throw an exception. Use [my fork of Browserify](https://github.com/ben-ng/node-browserify/archive/master.zip) until [the PR](https://github.com/thlorenz/combine-source-map/pull/6) is merged. | ||
@@ -23,3 +23,2 @@ ## Usage | ||
, bundle = new browserify() | ||
, transforms = [require('hbsfy')] | ||
, opts = { | ||
@@ -32,10 +31,5 @@ // The URL the source is available at | ||
// Use this option to compress paths | ||
, compressPaths: function (p) { | ||
return path.relative('./www', p); | ||
} | ||
// If you use transforms, specify them here | ||
// If you use transforms, specify them as an option | ||
// Do *not* apply them to the bundle yourself! | ||
, transforms: transforms | ||
, transforms: [ require('hbsfy') ] | ||
}; | ||
@@ -52,3 +46,17 @@ | ||
## FAQ | ||
* How does this work? | ||
Minifyify uses the `--list` advanced option in browserify to discover what files are in your bundle. It then uglifies each file, adds an inline sourcemap, and runs browserify on the minified files. Browserify will combine and offset the sourcemaps. | ||
* Why don't I apply transforms myself? | ||
Minifyify needs to know your transforms to create the dependency graph and minify things like precompiled templates. Since there is no public API to do this in browserify, transforms have to be specified as an option. | ||
* Why does the sourcemap cause my debugger to behave erratically? | ||
Some of the optimizations UglifyJS performs will result in sourcemaps that appear to broken. For example, when UglifyJS uses the comma operator to shorten statements on different lines, a single debugger "step" in minified code may execute multiple lines of the original source. | ||
## License | ||
MIT |
@@ -45,3 +45,3 @@ var _ = require('lodash') | ||
, map: path.relative(encAppDir, fixtures.bundledMap(encAppname)) | ||
, transforms: [require('hbsfy')] | ||
, transforms: [require('hbsfy'), require('envify')] | ||
}; | ||
@@ -48,0 +48,0 @@ |
var View = require('./view') | ||
, viewInstance = new View({el: document.getElementById('target')}); | ||
, viewInstance = new View({el: document.body}); | ||
viewInstance.render(); |
var Backbone = require('backbone') | ||
, $ = require('../libraries/Jquery') | ||
, $ = require('jquery-browserify') | ||
, _ = require('lodash') | ||
, View; | ||
Backbone.$ = $; | ||
View = Backbone.View.extend({ | ||
template: _.template('<%= message %>') | ||
, render: function () { | ||
this.el.innerHTML = (this.template({message: 'Hello From View Line 5'})); | ||
this.el.innerHTML = (this.template({message: 'Hello From View Line 11'})); | ||
@@ -11,0 +13,0 @@ return this; |
@@ -8,3 +8,3 @@ var myString = ['Open','Your','Dev','Tools!'] | ||
header.innerHTML = myString; | ||
header.innerHTML = anotherString; | ||
document.body.appendChild(header); | ||
@@ -11,0 +11,0 @@ |
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
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
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
638592
16032
59
10
6
40
2