Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

请问vue-cli3.0构建的项目注入的html和css如何压缩? #36

Closed
leiyaguang opened this issue Aug 21, 2018 · 2 comments
Closed
Assignees
Labels

Comments

@leiyaguang
Copy link

leiyaguang commented Aug 21, 2018

请问vue-cli3.0构建的项目注入的html和css如何压缩?

@leiyaguang leiyaguang changed the title 请问vue-cli3.0构建的项目如何配置 请问vue-cli3.0构建的项目注入的html和css如何压缩? Aug 21, 2018
@xiaoiver
Copy link
Collaborator

xiaoiver commented Sep 11, 2018

html-webpack-plugin 使用 html-minifier 对 HTML 进行压缩,所以可以通过 html-webpack-plugin 插件的 minify 配置对象进行配置:

new HtmlWebpackPlugin({
            minify: {
                removeComments: true,
                collapseWhitespace: true,
                removeAttributeQuotes: true,
                minifyCSS: true // 压缩内联的 CSS
            }
        }),

@xiaoiver xiaoiver self-assigned this Sep 11, 2018
@twoer
Copy link

twoer commented Dec 25, 2019

@xiaoiver

new HtmlWebpackPlugin({
            minify: {
                removeComments: true,
                collapseWhitespace: true,
                removeAttributeQuotes: true,
                minifyCSS: true // 压缩内联的 CSS
            }
        }),

vue cli 3.0 的项目里面,这段代码具体配置在什么位置,我配置后,发现 html 压缩了,但是 css 没有压缩,麻烦指点一下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants