GithubHelp home page GithubHelp logo

jamietre / css-visor Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zikaari/css-visor

0.0 3.0 0.0 23 KB

Webpack supervisor to inject and hot update stylesheets with sourcemaps

License: MIT License

JavaScript 100.00%

css-visor's Introduction

css-visor

The ultimate style-loader replacement you knew you needed

css-visor is like a supervisor that finds, injects and updates your imported stylesheets - with sourcemaps and no Flash of Unstyled Content

Background

css-visor was created out of long living pain as seen in:

Usage

Install it

npm install --save-dev css-visor

Light it up

// webpack.config.js

const CSSVisor = require('css-visor')
const HtmlWebpackPlugin = require('html-webpack-plugin')

module.exports = {
    // existing config
    module: {
        rules: [{
            test: /\.css$/,
            use: [
                'css-visor/loader',
                {
                    loader: 'css-loader',
                    options: {
                        sourceMap: true,
                    }
                },
                // more loaders (sass, postcss)
            ]
        }]
    },
    plugins: [
        new CSSVisor(),
        new HtmlWebpackPlugin({
            inject: true
        })
    ]
}

It should now be working out of the box.

Not working? Make sure to have css-visor/loader right before css-loader and instance of CSSVisor in plugins list of your webpack config.

Still not working? Please file an issue to have it known

Reliability

css-visor is literally built from source of extract-loader. So far, it has shown no problems, even with imported stylsheets, images/svg's (processed through url-loader/file-loader).

The only things you can import in a CSS file anyway.

css-visor's People

Contributors

zikaari avatar

Watchers

 avatar  avatar  avatar

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.