Comments (5)
Hi! Thanks for the feedback. I am totally open to setting the node version to current if that works for dependencies here. As it is, the current recommended workflow is a snippet in the readme file anyway! :)
Any reason I shouldn't set it to latest (14 looks like)? Thanks
from loadcss.
Any reason I shouldn't set it to latest (14 looks like)? Thanks
As I understood node release cycle 14 is only meant for libraries to test integration not for apps in production. So if you set it to 14 most apps won't be able to install it. 13 is meant for library integration. 14 is meant for production.
12 would be the active lts. 10 is still maintained though and since this code is meant to work in the browser you probably don't rely on any features in node 11 or 12.
We used it for lazy loading CSS of 3rd party libraries for certain components. It was quite handy since the user of the component didn't need to make sure they setup dependencies which can lead to dead CSS if the component is removed but not the dependencies e.g.
export default function AppSearch() {
React.useEffect(() => {
const styleNode = loadCSS(
'https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css',
document.querySelector('#app-search'),
);
return () => {
styleNode.parentElement.removeChild(styleNode);
};
}, []);
}
As it is, the current recommended workflow is a snippet in the readme file anyway! :)
Sure but this change is a good example why having this as a dependency is preferred. I never looked into the best way of lazy loading css and trusted that you did. By inlining it, it's now more code that can become outdated.
from loadcss.
from loadcss.
Hey, just to give my personal anecdote of how I came across this thread -
Deploying a new Rails 6 app to Heroku, the default Node version is only 10.15. However this library (which I use) requires 11, so now I need to do a complicated dance to get my app properly deployed.
I would request that we please change it back to Node 10 dependency, it is better to make it continue work on older Node versions
from loadcss.
Node 10 has reached its end-of-life so this issue is no longer relevant.
from loadcss.
Related Issues (20)
- FOUC on 'No Throttled' condition? HOT 2
- Polyfill has an issue in chrome
- Optionally preload without as attr?
- Don't rely on invalid media attributes to download? HOT 10
- standalone or via npm?
- element with id `global` prevents loadCSS execution
- Error thrown by Content-Security-Policy HOT 5
- Supports preload
- Cannot use inline 'onload' because of CSP HOT 6
- The plugin doesn't do anything to preload elements in Firefox HOT 1
- Cannot install version 3.0.0 because node version is hardcoded to 11.9.0 HOT 5
- Where has the cssrelpreload polyfill gone in 3.0.0? HOT 2
- Export onloadCSS
- CSS is being loaded twice HOT 3
- loadCSS not helping with render-blocking content
- Why do I sometimes get a recommendation in google pagespeed 'Reduce unused CSS' ? HOT 1
- Wouldn't loading css asynchronously cause FOUC? HOT 1
- Calling loadCSS from a TypeScript Vite application throws Uncaught TypeError: Cannot read properties of undefined (reading 'createElement') at loadCSS (loadCSS.js:13:16)
- Help - loadCSS/Critical file load not working
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from loadcss.