D
D
Dmitry2018-02-11 18:36:37
JavaScript
Dmitry, 2018-02-11 18:36:37

JS include when building in gulp how to implement?

I’ve been writing a lot of questions lately) I’m building a collector on gulp. Here you need to somehow include js in js files.
So far I have found only this solution https://www.npmjs.com/package/gulp-include
But I would like to generate a sourcemap if possible, maybe there are some other solutions.
It would probably be possible to implement this with the js preprocessor, but I think it’s too early to work in the preprocessor on js )

Answer the question

In order to leave comments, you need to log in

5 answer(s)
D
Dmitry, 2018-02-12
@kaktys123

in general, I myself found two options, well, I think this will be enough.
1. gulp-include is the best solution if you are not doing large projects directly or there are some plugins. And you can try gulp-sourcemaps in addition to it, maybe they will also be able to generate maps for whoever needs it. But gulp-include can include not only js, but also any files, even html.
2. gulp-browserify for those who do not want to give up gulp, but there are a lot of pluses here and you can organize modularity. This is for those who work on a large scale.
In general, this solution can help someone.

A
Andrey Tsvetkov, 2018-02-11
@yellow79

I use gulp-rigger for this in my projects, it can be useful not only for JS

Q
qwead, 2018-02-11
@qwead

browserify?

D
Dubrovin, 2018-03-02
@Dubrovin

Use RollupJS. Unlike webpack and browserify, it collects files without any garbage. Unlike gulp include, you can use the import, export es2015 syntax.

A
Alexander Kositsyn, 2018-02-11
@alex_keysi

If the project is small then use parcel. You write one script in the console and that's it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question