Giter Site home page Giter Site logo

Comments (9)

Wildhoney avatar Wildhoney commented on August 19, 2024

Thanks for raising these issues, Elliott! 👍 I will look at this one a little later.

from reactshadow.

pablinos avatar pablinos commented on August 19, 2024

I was wondering about all the server requests even if this caching issue didn't exist.
Maybe a solution to this issue though is to use one style tag and group insert the @import statements as needed?

from reactshadow.

Wildhoney avatar Wildhoney commented on August 19, 2024

Polymer addressed this issue with their Vulcanize tool, but I'm not entirely sure how that's going to behave with React components. However it would considerably reduce server requests in production.

Edit: If you add gulp-vulcanize to your Gulp process, then it's not something ReactShadow needs to address directly. If Chrome has caching issues with @import though then I agree ReactShadow needs to utilise an alternative in the meantime, as not everybody is going to be vulcanizing their components.

from reactshadow.

esprehn avatar esprehn commented on August 19, 2024

Note that you don't really want to use @import in production anyway because the async fetch of the sheet will cause FOUC.

from reactshadow.

tjwudi avatar tjwudi commented on August 19, 2024

It will be fantastic to add support for pure CSS source and drop support for cssDocuments as a function. You can take at look at my fork impl at tjwudi/react-shadow-dom.
This helps a lot because we can then build a grunt or gulp plugin for react-shadow, which automatically read and insert css rules into javascript.
In this case, you don't even need to fetch any css anymore, in production.

from reactshadow.

Wildhoney avatar Wildhoney commented on August 19, 2024

@tjwudi How would adding the cssSource property differ from writing the styles inline as part of the React component? Although I think I understand what you're trying to achieve. Do you imagine as part of the build process, transferring all of the CSS styles from the documents defined in cssDocuments into the cssSource property?

from reactshadow.

tjwudi avatar tjwudi commented on August 19, 2024

@Wildhoney Right. Component design is good for development, but we will always want to pack them into a big package in delivery. We sure can use css @import at development stage. Then we inline all css source in the building stage.

from reactshadow.

Wildhoney avatar Wildhoney commented on August 19, 2024

Agreed. In that case I'm happy to merge in your cssSource changes from your forked branch, if you want to go ahead and open a PR for it 👍

from reactshadow.

tjwudi avatar tjwudi commented on August 19, 2024

Of course I would :)

from reactshadow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.