jbedard / html-insert-assets Goto Github PK
View Code? Open in Web Editor NEWInsert assets such as .js, .css into an HTML file.
License: MIT License
Insert assets such as .js, .css into an HTML file.
License: MIT License
I would like to use this package for a PWA.
Thus a --manifest
argument would be really handy.
Example
--manifest manifest.webmanifest
should result in
<link rel="manifest" href="manifest.webmanifest" />
hashes, last-modified etc
... this is sometime nicer when invoking the cli programatically, also seems to be semi-standard.
In some contexts, this attribute is needed in the generated assets
Since the parse5 upgrade?
TypeError: treeAdapter.getChildNodes is not a function or its return value is not iterable
at findElementByName (.../node_modules/html-insert-assets/dist/main.js:35:33)
at findElementByName (.../node_modules/html-insert-assets/dist/main.js:36:24)
at Object.main (.../node_modules/html-insert-assets/dist/main.js:297:18)
at Object.<anonymous> (.../node_modules/html-insert-assets/dist/run.js:4:27)
I have been trying to understand why this package was not working. I have been getting an error when I put a statement into my docker file like this;
RUN html-insert-assets --out index.html --assets switch.css switch.js --verbose
It was giving an error;
/usr/local/bin/html-insert-assets: 1: /usr/local/bin/html-insert-assets: //: Permission denied /usr/local/bin/html-insert-assets: 3: /usr/local/bin/html-insert-assets: Syntax error: "(" unexpected
Turns out that the bin was pointed out to be src/main.js which does not include a shebang statement to tell how to interpret this binary which is the main reason for the error.
Page load times can be decreased by preloading links: https://web.dev/uses-rel-preload/
Which can be added to the head of a document:
<head>
...
<link rel="preload" href="styles.css" as="style">
<link rel="preload" href="ui.js" as="script">
...
</head>
Would be cool to see something like this:
html-insert-assets
--preload my.js my.css
when a base href is used than the injected js + asset file paths wont work. It always tries to
go to the main domain instead off the subfolder where the app is running
example:
domain.com/shop/app -> the injected paths with leading slash will show to domain.com/xxx.js instead of domain.com/shop/app/xxx.js.
In the head of my html I have a link to a font like this
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet" async />
But after running html-insert-assets
I get this as an output:
<link href="https://fonts.googleapis.com/css2?family=Roboto&display=swap" rel="stylesheet" async="">
Not the difference of async
. It is now async=""
. But it should just be async
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.