Coder Social home page Coder Social logo

Comments (3)

ViRuSTriNiTy avatar ViRuSTriNiTy commented on May 21, 2024

A solution that uses a workaround has been posted here:

bennypowers/rollup-plugin-lit-css#23

I'm also still trying to find out the right way to do it.

from rollup-plugin-styles.

ViRuSTriNiTy avatar ViRuSTriNiTy commented on May 21, 2024

The solution posted above does not seem to work anymore (at least for me) as it seems to target Lit 2.x.

I have analyzed the plugin code and its dependencies and my impression is that the documentation is misleading. It reads like you just need to add this and that module, add this and that line and it flies but it does not.

The underlying issue here is that rollup-plugin-lit-css just processes pure CSS as

https://github.com/bennypowers/lit-css/blob/74dc908cd05c177267cdd3df6bdca1c9821630e8/packages/rollup-plugin-lit-css/rollup-plugin-lit-css.ts#L33

along with the other filter code completely ignores .scss files by default and due to the hard-coded css extension check and the missing support for transforming the id the whole construct just breaks.

You could fiddle something together by manually altering the files in the node_modules folder so that it processes the files but then the plugin has no import of node-sass or sass whatsoever so the .scss file would not be parsed correctly.

I think it must be a 3 step solution in rollup.config.js like

plugins: [
	styles({
      mode: "emit"
    }),
	sassToCss(), // custom plugin that calls sass and compiles (aka transforms in terms of a plugin) the sass 		    
    litCss()
]

There are plugins that transform SASS to CSS but these are already working without rollup-plugin-styles or rollup-plugin-lib-css:

But these are somewhat outdated as both still use node-sass.

I still wonder how the tests in __tests__ can even run scss imports. Perhaps the secret is buried there 🙄

from rollup-plugin-styles.

ViRuSTriNiTy avatar ViRuSTriNiTy commented on May 21, 2024

I have given up to solve this after multiple hours of searching the needle in the haystack.

You can use https://www.npmjs.com/package/@j1shin/rollup-plugin-lit-sass to achieve what you want, just follow the description of the package. All necessary steps are explained.

from rollup-plugin-styles.

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.