Comments (2)
This is to be expected from how the HeadPlugin currently operates. It will remove any stylesheets that are not present in the upcoming page. I've created a pull request to allow persisting stylesheets across page loads which would solve this problem.
In the meantime, I'd suggest going the first route you mentioned, moving all the transitions to a global stylesheet that is loaded on every page.
from docs.
Having a single file for this kind of global styles (especially styles needed for transitions of swup) is the preferred option, so they are preserved and always exist on the page.
Including such styles (with the same or different definition) in different style files that are replaced on the page by the plugin will likely lead to swup freezing at some point, and probably not always (which is even worst tho, as you might not even know it happens).
Imo loading of styles placed into the Head by the plugin can take some time. On slower connections, you could end up with flashing ugly pages during the transitions. That being said, unless the size of your whole website CSS in one file adds significantly to the initial page load time, I would personally make that tradeoff. Also, there are ways to speed up the initial page load as well while the one bigger CSS file would be loading so that probably can be addressed separately.
As far as the styling of elements on different pages with the same classes/IDs, I would suggest to checkout BEM. Makes the styles really clean for the whole project.
Just some thoughts...
Anyway, @daun's new options were also added to the Head plugin are available in the plugin v1.1.0. 🎉
from docs.
Related Issues (20)
- Improve pages that lead to external ressources HOT 1
- Convert list of events from table to list
- Ensure running `lint` when pushing
- Transition object HOT 1
- Rewrite Common Issues
- Document new option `animationScope` HOT 1
- Migrate from `markdown-it` to `remark`
- Archive v3 docs HOT 1
- Exclude some pages from the search HOT 3
- Find a way to not auto-format code snippets in md files
- Problem reloading carousel ( flickity in swup ) HOT 1
- Couple of Questions HOT 1
- Error HOT 1
- Document current browser support
- Allow cookie banner on docs HOT 4
- Revamp documentation site
- Add ES module CDN example
- Render anchor links for headlines
- Move docs to 11ty HOT 1
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 docs.