GithubHelp home page GithubHelp logo

Comments (9)

sokra avatar sokra commented on June 27, 2024

That doesn't work, and makes no sense.

The useable API enables and disables styles on use and unuse. You cannot enable and disable the styles anymore when they are in a external stylesheet.

from extract-text-webpack-plugin.

charandas avatar charandas commented on June 27, 2024

@sokra thanks for clearing that up.

Can you reiterate in a few words what this plugin does? The readme is quite terse at this point :)

from extract-text-webpack-plugin.

sokra avatar sokra commented on June 27, 2024

It moves every require("style.css") in entry chunks into a separate css output file. So your styles are no longer inlined into the javascript, but separate in a css bundle file. If your total stylesheet volume is big, it will be faster because the stylesheet bundle is loaded in parallel to the javascript bundle.

Advantages:

  • Fewer style tags (older IE has a limit)
  • CSS SourceMap
  • CSS requested in parallel
  • CSS cached separate
  • Faster runtime (less code and DOM operations)

Caveats:

  • Additional HTTP request
  • Longer compilation time
  • Complexer configuration
  • No runtime public path modification

from extract-text-webpack-plugin.

charandas avatar charandas commented on June 27, 2024

That's nice and verbose. Perhaps, can be moved to the README.

Last question, when I include the bundled css, I do so directly in html. There is the customary /*# sourceMappingURL=bundle.js.map*/ at the end, however, chrome still shows me references to bundled css only.

Could I be missing something?

from extract-text-webpack-plugin.

charandas avatar charandas commented on June 27, 2024

@sokra ping

from extract-text-webpack-plugin.

sokra avatar sokra commented on June 27, 2024

You need to enable SourceMaps in devtools.

You need to use the devtool: "sourcemap" option.

in html you need something like <link rel="stylesheet" href="bundle.css">

from extract-text-webpack-plugin.

charandas avatar charandas commented on June 27, 2024

Thanks! That brings up an interesting point. I removed my devtool: "sourcemap" option to make JS sourcemaps work with absolute paths in webstorm. It's starting to appear, I can choose only one or the other, but not both.

 new webpack.SourceMapDevToolPlugin(
            '[file].map', null,
            "[absolute-resource-path]", "[absolute-resource-path]")

Word?

from extract-text-webpack-plugin.

sokra avatar sokra commented on June 27, 2024

devtool: "sourcemap" is just a shortcut for the SourceMapDevToolPlugin.

from extract-text-webpack-plugin.

charandas avatar charandas commented on June 27, 2024

Thanks 👍

from extract-text-webpack-plugin.

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.