I´m looking into switch from gulp/grunt to only use npm scripts. But I cant really solve how to get *.js and *.css from a given path and add it to the index.html file.
must I add it thru a "index.js" file or can I do something like...
"scripts": {
"inject": "inject src/app/*.js",
},
and then it will add it in my index.html where I have specified it like...
/* inject:js */
Where should I include my JavaScript and CSS code in the HTML page – inline or external file? The typical answer is: Add JavaScript code by the end of the </body> tag and. Add CSS code in-between the <head> tags.
Inline JavaScriptYou can insert JavaScript directly into an HTML file.
To include an external JavaScript file, we can use the script tag with the attribute src . You've already used the src attribute when using images. The value for the src attribute should be the path to your JavaScript file. This script tag should be included between the <head> tags in your HTML document.
The suggestion by Chris Traveis worked out pretty nice. So the answer to my problem was solved using https://www.npmjs.com/package/postbuild
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With