A
A
Arthur2015-04-09 18:53:43
JavaScript
Arthur, 2015-04-09 18:53:43

How to glue (concatenate) files inscribed in html?

Hey!
Prompt a console (CLI) tool on NodeJS for automatic merging of files specified in HTML.
For example, there is an index.html
it contains:

<!-- concat js/all.js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/bootstrap-sass/assets/javascripts/bootstrap.js"></script>
<!-- endconcat -->

with one console command, it all turns into the all.js file in the js directory
and in index.html
<!-- concat js/all.js -->
<script src="bower_components/jquery/dist/jquery.js"></script>
<script src="bower_components/bootstrap-sass/assets/javascripts/bootstrap.js"></script>
<!-- endconcat -->

turns into
<script src="js/.js"></script>
Gulp and other assemblers are not suitable :(
many small projects, it is expensive to produce node_modules and other files everywhere, and for a long time

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Artur, 2015-04-09
@astralo

Fortunately, I found what I was looking for
https://github.com/digisfera/useref-file
wrapper for userref, which Gulp also has by the way

K
Konstantin Kitmanov, 2015-04-09
@k12th

Gulp and other assemblers are not suitable :(
many small projects, it is expensive to produce node_modules and other files everywhere, and for a long time

Well, that's exactly what they're designed for. And if you don’t know how to cook them, then it’s time to learn.
Here, for example, is a plugin for Grunt , which only needs to slip in a suitable regular expression. No one will make a separate solution for replacing strings, everyone understands that this should be in task runners.

M
Mikhail Osher, 2015-04-09
@miraage

Procreate? And gitignore was not taught to do unnecessary things?)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question