Skip to content
This repository was archived by the owner on Feb 1, 2020. It is now read-only.
This repository was archived by the owner on Feb 1, 2020. It is now read-only.

Doesn't work with Vue #68

Description

@outOFFspace
  • Webpack config:
const plugins = [
    new ExtractTextPlugin({filename: '[name].[contenthash].css', allChunks: true}),
    new PurgecssPlugin({
        paths: glob.sync([
            path.join(__dirname, './../app.html'),
            path.join(__dirname, './../**/*.vue')
        ])
    })
];
const rules = [
    {
        test: /\.vue$/,
        loader: 'vue-loader',
        options: {
            transformToRequire: {vector: 'src', img: 'src', image: 'xlink:href'},
            loaders: {
                css: ExtractTextPlugin.extract({
                    use: 'css-loader',
                    fallback: 'vue-style-loader'
                }),
                i18n: '@kazupon/vue-i18n-loader',
                sass: 'vue-style-loader!css-loader!sass-loader?indentedSyntax=1&data=@import "./src/assets/sass/variables"',
                scss: 'vue-style-loader!css-loader!sass-loader?data=@import "./src/assets/sass/variables";'
            }
        }
    },
    {
        test: /\.js$/,
        loader: 'babel-loader?cacheDirectory=true',
        exclude: /node_modules/,
        include: [resolve('src'), resolve('test')]
    },
    {
        test: /\.(png|jpe?g|gif)(\?.*)?$/,
        loader: 'url-loader',
        query: {
            limit: 10000,
            name: utils.assetsPath('img/[name].[hash:7].[ext]')
        }
    },
    {
        test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
        loader: 'url-loader',
        query: {
            limit: 10000,
            name: utils.assetsPath('fonts/[name].[hash:7].[ext]')
        }
    },
    {
        test: /\.svg$/,
        loader: 'svg-inline-loader'
    },
    {
        test: /\.css$/,
        use: ExtractTextPlugin.extract({
            use: 'css-loader',
            fallback: 'vue-style-loader'
        })
    }
];
...
  • purgecss-webpack-plugin: ^1.4.0
  • Behavior: It should not include unsusable styles in .css-file

I have single file component with this style:

<style>
    .asdasdas {
        color: #f0f2fa;
    }
    .css-pseudoselect .item-pseudoselect {
        padding-right: 25px;
    }

    .autocomplete .options .item:hover .blue,
    .css-pseudoselect .options .item:hover .blue {
        color: #256799;
    }

    .css-pseudoselect .options .item,
    .options .item,
    option {
        white-space: normal;
        line-height: 18px;
        box-sizing: border-box;
        padding: 5px 6px;
    }

    .options .item:hover,
    option:hover {
        background-color: #f0f2fa;
        color: #414141;
    }

    .pseudoselect .options {
        white-space: normal;
    }

    .pseudoselect .options label:before {
        position: absolute;
        left: 0;
        top: 1px;
        margin: 0;
    }

    .pseudoselect .options label {
        position: relative;
        display: inline-block;
        padding-left: 25px;
    }

    @media (min-width: 769px) {
        body .app-header .container-header,
        .container-body > .container,
        .container-main, .app-content,
        .container-header {
            z-index: unset !important;
            position: relative !important;
        }

        .fixed-branding,
        .fixed-branding a {
            z-index: unset !important;
        }
    }
</style>

But purgecss doesn't cut class .asdasdas from styles files.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions