Code Monkey home page Code Monkey logo

Comments (5)

alexander-akait avatar alexander-akait commented on June 12, 2024 3

Pipeline is simple CSS -> JS -> Apply styles to DOM

  • css-loader track url()/import and convert it to import ... from ..., also if you use CSS modules your classes will be hashed and exported from generated JS files, css-loader returns array of styles like ['module-name.css', '.class { color: red }', 'source-map'] (there are more fields, just simplified for example)
  • style-loader just get exported array and apply them to DOM + add code for hot module reloading, so you don't reload page when you changes styles

In other hard - mini-css-extract-plugin gets array and create CSS files, so you can use <link>, also if you have async CSS plugin generates JS code for loading them

from style-loader.

ParSal123 avatar ParSal123 commented on June 12, 2024 1

Pipeline is simple CSS -> JS -> Apply styles to DOM

  • css-loader track url()/import and convert it to import ... from ..., also if you use CSS modules your classes will be hashed and exported from generated JS files, css-loader returns array of styles like ['module-name.css', '.class { color: red }', 'source-map'] (there are more fields, just simplified for example)
  • style-loader just get exported array and apply them to DOM + add code for hot module reloading, so you don't reload page when you changes styles

In other hard - mini-css-extract-plugin gets array and create CSS files, so you can use <link>, also if you have async CSS plugin generates JS code for loading them

Thank you,
Still, I think if this could be added to the docs somewhere (like a separate "How it works" section) along with a simple example it would be nice and more understandable.

from style-loader.

alexander-akait avatar alexander-akait commented on June 12, 2024 1

@nyngwang Yeah, feel free to send a PR to our docs, still not documented

from style-loader.

alexander-akait avatar alexander-akait commented on June 12, 2024

So if you need another logic than apply styles to DOM you can use own loader, but it is rare or specific usage

from style-loader.

nyngwang avatar nyngwang commented on June 12, 2024

@alexander-akait Is this one added? If so then this can be closed. If not, I can help update the website of webpack later this/next month.

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.