Giter VIP home page Giter VIP logo

Comments (10)

ronkorving avatar ronkorving commented on May 28, 2024 1

Got it, I didn't know you meant it that literally :)
So what I do with my dom-loader is

{ test: /\.css$/, loader: 'dom?tag=style&attrs[]=type:text/css!css' }

from style-loader.

ronkorving avatar ronkorving commented on May 28, 2024

If I make a PR for this, is there any chance of it getting merged?

from style-loader.

ronkorving avatar ronkorving commented on May 28, 2024

@sokra I've been trying to figure out how to implement this, but it looks next to impossible with the way this loader is set up. Perhaps I'm wrong, but then I would love some pointers in the right direction. If I really want this, am I better off making my own loader?

from style-loader.

tzapu avatar tzapu commented on May 28, 2024

i m not sure what features you are loosing by doing this, but i was able to do the above using css-to-string-loader loader and just adding the style var manually

from style-loader.

ronkorving avatar ronkorving commented on May 28, 2024

How do you achieve that? In the mean time I released https://www.npmjs.com/package/dom-loader that can be used for this (and other elements).

from style-loader.

tzapu avatar tzapu commented on May 28, 2024

i use a react render to iframe component and i needed css reset to be rendered in the iframe, not in the main head. using css to string, i load the css in a var and pass it to the Frame component

import mainStyles from 'normalize.css';
...
  <Frame style={styles.frame} scrolling={'no'}
             initialContent={`<!DOCTYPE html><html style="width: 100%; height: 100%;">
             <head><style type="text/css">${mainStyles}</style></head>
             <body>
             <div></div>
             </body></html>`}>

seems to work fine for me
cheers

from style-loader.

ronkorving avatar ronkorving commented on May 28, 2024

What is "CSS to string"? You mean just a raw loader?

from style-loader.

tzapu avatar tzapu commented on May 28, 2024

https://www.npmjs.com/package/css-to-string-loader

from style-loader.

SpaceK33z avatar SpaceK33z commented on May 28, 2024

@ronkorving, was your issue fixed with that loader? I don't think this functionality should be in style-loader.

from style-loader.

ronkorving avatar ronkorving commented on May 28, 2024

I went with my alternative at the time, so can't really say. It probably worked fine. I'll close this issue, sorry for having kept it open so long.

from style-loader.

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.