Comments (11)
Not sure why that happens for you, just tried and all succeeded:
mkdir /tmp/test && cd /tmp/test
echo '{ "dependencies": ["mincer"] }' > package.json
npm install
mkdir -p {app,vendor}/assets/javascripts
echo 'alert("BOOM");' > vendor/assets/javascripts/abc.js
echo '//= require abc' > app/assets/javascripts/main.js
node node_modules/.bin/mincer \
--include app/assets/javascripts \
--include vendor/assets/javascripts \
--output public \
main.js
find public -type f | while read filename; do
echo "=== ${filename} ==="
cat $filename
echo
done
Outputs:
/tmp/test
`-- [email protected]
+-- [email protected]
| `-- [email protected]
+-- [email protected]
| `-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
| `-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]
npm WARN test No description
npm WARN test No repository field.
npm WARN test No license field.
debug Compiled main.js (16ms)
Writing /tmp/test/public/main-cfa61cf97edbed15ba3d2a83208167b0.js
=== public/manifest.json ===
{
"assets": {
"main.js": "main-cfa61cf97edbed15ba3d2a83208167b0.js"
},
"files": {
"main-cfa61cf97edbed15ba3d2a83208167b0.js": {
"logical_path": "main.js",
"mtime": "2016-05-20T11:57:42.000Z",
"size": 34,
"digest": "cfa61cf97edbed15ba3d2a83208167b0"
}
}
}
=== public/main-cfa61cf97edbed15ba3d2a83208167b0.js ===
alert("BOOM");//(=) require abc
;
from mincer.
I'm on mincer 1.3.0. I'll check if upgrading fixes this, and if not continue investigating what may be happening on my end.
from mincer.
I upgraded to the latest version and still no luck. Your example runs perfectly fine though, so I'll continue to investigate any possible differences and report back.
from mincer.
Obviously it was developer blindness/stupidity. The asset I was trying to compile was in a sub-directory of app/assets/javascripts
so I was passing the wrong logical path in the command line. It should have been something like:
node_modules/.bin/mincer --include app/assets/javascripts --include vendor/assets/javascripts my-app/main.js
However it seems like the CLI utility has no way of compressing assets, or am I missing something?
from mincer.
Well, cli is pretty simple yeah. And honestly was implemented only as an attempt to match sprocket's CLI. But I don't see any realy practical usage of it. IMHO it's better to write your own runner that will be configure Mincer environment the way you need. And will be:
- easier to read
- easier to maintain
- reliable
etc... :D
from mincer.
Well, I just needed a one time compression of assets, so I thought I'd use the CLI. Would you take a PR to add compression support to the CLI? Something like:
mincer --include something --js-compressor uglify asset.js
from mincer.
#!/usr/bin/env node
var Mincer = require("mincer"),
environment = new Mincer.Environment(__dirname);
environment.appendPath("app/assets/javascripts");
environment.appendPath("vendor/assets/javascripts");
environment.enable("autoprefixer");
environment.jsCompressor = "uglify";
environment.cssCompressor = "csswring";
var manifest = new Mincer.Manifset(environment, "public");
manifest.compile(["main.js"]);
from mincer.
Yeah. I'm OK with PR that will allw configure js/css compressor on CLI, as well as --enable
.
from mincer.
What is --enable
?
from mincer.
to enable different plugins, like autoprefixer for example
from mincer.
Ah! Good point :)
from mincer.
Related Issues (20)
- manifest.compile is not returning to console HOT 2
- Problem with tpl.js files HOT 3
- Update autoprefixer dependencies HOT 1
- Jade deprecation warning is so damn ugly in my log HOT 1
- Sourcemaps combined with Autoprefixer fails HOT 7
- Manifest#compile does not support regExp files patterns.
- Supporting polymer webcomponents HOT 1
- Expose the prop method in the mincer instance HOT 3
- Request - Support HTML files in directive processor HOT 2
- ejs support HOT 2
- require_glop directive HOT 1
- Change deprecated use of csso.justDoIt() to csso.minify() HOT 1
- please version bump!
- Generating bootstrap-sass source map via connect-assets is throwing an "Invalid mapping" error
- Promise based support for Template.prototype.evaluate HOT 8
- Support for CoffeeScript v2 HOT 4
- Update dependencies HOT 1
- Firefox's save feature does not work with the sass file
- Maintenance HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mincer.