Giter VIP home page Giter VIP logo

Comments (5)

nmn avatar nmn commented on August 30, 2024 1

When I am doing production build. I can see seperate CSS file generated but it is not attached to the index file . Am I missing something?

The StyleX Webpack plugin only emits a CSS file. It doesn't inject it into the HTML file for you. This is intentional because we expect you to be using a component framework to render your markup and not use a static HTML file.

from stylex.

techdiary avatar techdiary commented on August 30, 2024 1

hey @nmn, I've a dumb question. Since stylex is emitting CSS file and not injected to static HTML file.
Does this mean, only next.js and similar frameworks are supported?

@omkar-nath to solve your problem, you have to manually update your source index.html file to include css link .
Example:

<head>
  <link rel="stylesheet" type="text/css" href="./stylex.css" />
</head>

from stylex.

techdiary avatar techdiary commented on August 30, 2024 1

Thank you Naman for clarifying. I'll try to look into html-webpack-plugin and see if it can create the link to the stylesx css file.

from stylex.

nmn avatar nmn commented on August 30, 2024

Since stylex is emitting CSS file and not injected to static HTML file.
Does this mean, only next.js and similar frameworks are supported?

Since we're so new our bundler integrations are still experimental, but you should really be able to use StyleX in any JS-based component framework. This includes things like create-react-app or client-rendered apps with Solid, Vue or Svelte.

For now you'll have to find ways to integrate the compiler yourself. We're working with the community to make the bundler plugins better.

For now, the recommendation is to add the link tag manually as in your comment.

from stylex.

deadalnix avatar deadalnix commented on August 30, 2024

Even though this is closed, and I understand this is not really an issue with stylex, I was nevertheless wondering how this could be worked around in the case where the name contains [contenthash], something that cannot be hardcoded, and that is necessary to play nice with caching layers one might run into.

from stylex.

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.