Coder Social home page Coder Social logo

Comments (3)

joeldenning avatar joeldenning commented on July 30, 2024

Yes, you can use single-spa-css to load css files that are in separate files. I'd like to switch over create-single-spa and vue-cli-plugin-single-spa over to use it rather than style-loader in production, but haven't done so yet. You can still do so though for your projects by modifying the webpack config to use https://webpack.js.org/plugins/mini-css-extract-plugin/ rather than style-loader.

from styleguide.

miusuncle avatar miusuncle commented on July 30, 2024

single-spa-css is meant to use for single-spa app or parcel. But styleguide is of type utility and it doesn't make any sense to expose lifecycle methods(bootstrap, mount, unmount).


After some investigation, I've comed up with two solutions:

  1. Export cssLifecycles from styleguide utility, then import and integrate them to one of exist application lifecycles which always actived.
  2. Export cssLifecycles from styleguide utility, then register styleguide utility itself as application with activeWhen set to /

These two solutions work for me, I've chosed solution 1 after all, since it is weird to use utility as application. I've wonder if there any official recommend usage to combine single-spa-css with utility?

from styleguide.

joeldenning avatar joeldenning commented on July 30, 2024

One option for utility modules is to use css browser modules, which are supported by systemjs. The css file would be a runtime static dependency of the systemjs bundle (a webpack external) and then the utility module can add it to the adopted stylesheets. I don't usually broadcast it as a solution because it requires some additional polyfilling for IE11 and the spec for CSS modules wasn't as far along in the standardization process as it is now. But that way would work well

from styleguide.

Related Issues (4)

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.