U
U
urajo2021-07-24 12:05:37
JavaScript
urajo, 2021-07-24 12:05:37

How to use jquery via npm in gulp build?

How to connect jquery correctly if I use npm+gulp?
At the moment, I just made a folder in the src folder into which I throw off all the plugins, etc., through gulp they are transferred to the working project. In my opinion, this is inconvenient and wrong.
The question is how do I connect jq to a regular project (landing layout), I installed jquery via npm, in the project script file I write import $ from 'jquery'; but it doesn't work.
How can I start using the library?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valery, 2021-07-24
@vmakhnyuk

The fact is that gulp is not a collector (there are of course options for how to turn it), but a task runner.
In your case

regular project (landing layout)

I would just include jquery in the <script>tag:
// index.html
<body>
...
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</body>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question