remy / inliner

Node utility to inline images, CSS and JavaScript for a web page - useful for mobile sites
MIT License
1.1k stars 165 forks source link

Add ability to inline a file in place #161

Open specious opened 7 years ago

specious commented 7 years ago

I think it would be sweet to be able to inline a file in place, like:

inliner --inplace a.html

Instead of:

inliner a.html > b.html && mv b.html a.html

That would make it possible to do:

inliner *.html
remy commented 7 years ago

Not sure if that would be a sensible change. I'll keep this open for a little while in case anyone wants to take it on or a tonne of 👍 come in.

For anyone else reading: in place should not be default as it's destructive - which against my design principles (ie don't break things unexpectedly).

amv commented 7 years ago

I am guessing the last example was meant to be

inliner --inplace *.html

...but I also think that it would be a good idea to focus the limited development energy we have in the world on core functionality. This is probably a pretty unusual use case and if you need it in your custom build pipeline, you can use something like:

ls *.html | xargs -n1 -I{} sh -c 'inliner "{}" > "{}.inlined"; mv "{}.inlined" "{}"'

I think I would personally not turn down a well tested PR though, but can't speak for @remy ;)