N
N
nektobit2016-08-29 17:07:29
css
nektobit, 2016-08-29 17:07:29

Connecting js/css, how to do it with or without webpack?

A simple question to which I could not find a sane answer. How to correctly include js/css in the sequence I need (with dependencies). Everything I read about webpack is reminiscent of shooting sparrows from a cannon. If I need to combine dozens of js/css files and connect them to an html page, do I really need to do it manually? I guess there are a lot of "lazy" developers who have prepared a bunch of tools for this. So far, the method seems to be the most accessible https://habrahabr.ru/post/278033/
But even this is redundant, I just need to include libraries and css...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Q
qtuz, 2016-10-31
@qtuz

Webpack has a glob equivalent called require context :

require.context('./src', false, /\.(js|css)$/); 
// соберёт все js и css файлы из директории src

Yes. And how are you going to include dependencies in the sequence you need using glob? An example from your link
TOM.boot.load( 'libraries/*', [ 'jquery', 'scroll' ], function( ){ } );
- how should modules be sorted when connected if they depend on each other? By alphabet? By file size? By creation date?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question