ElemeFE / page-skeleton-webpack-plugin

Webpack plugin to generate the skeleton page automatically
MIT License
2.8k stars 393 forks source link

HtmlWebpackPlugin 如果设置了removeComents,后面没法读取<!-- shell -->? #14

Open hangoocn opened 6 years ago

Jocs commented 6 years ago

@imhangoo 你好,我没有在 html-webpack-plugin 的配置选项找到 removeComents,请问你是怎么设置的?能把配置文件贴出来吗

hangoocn commented 6 years ago

你好,我的意思是如果我本身想要在我自己项目里面开启 html-webpack-plugin的removeComents,那么是不是会和page-skeleton-webpack-plugin有冲突?有没有办法让它先replace完了再去removeComments啊

hangoocn commented 6 years ago

我把removeComments从 html-webpack-plugin 搬到了page-skeleton-webpack-plugin, 问题解决了,大神你的插件帮了我很大忙,多谢多谢

Jocs commented 6 years ago

@imhangoo 不客气,但是我还是没有找到 removeComments ?

hangoocn commented 6 years ago

new HtmlWebpackPlugin({ inject: true, template: paths.appHtml, minify: { removeComments: true }, }), new SkeletonPlugin({ pathname: './public/skeleton', staticDir: paths.appBuild, routes: ['/','/store/768','/store/146','/store/807'], port: '7890', loading: 'chiaroscuro', svg: { color: '#EFEFEF', shape: 'circle', shapeOpposite: ['.Rating-gray_1kpffd5_0 svg'] }, image: { shape: 'rect', // rect | circle color: '#EFEFEF', shapeOpposite: ['.mint-swipe-items-wrap img'] }, pseudo: { color: '#EFEFEF', // or transparent shape: 'circle', // circle | rect shapeOpposite: ['.delivery-icon-hollow_3q8_B5r_0', '.index-premium_39rl0v9'] }, button: { color: '#EFEFEF', excludes: ['.mint-swipe-items-wrap a'] }, defer: 5000, excludes: [], remove: [], hide: ['.index-dashedline_7B79b3W', '.Rating-actived_GBtiHkB_0'], grayBlock: ['#header'], cssUnit: 'rem', headless: true, minify: {removeComments: true} noInfo: false }),

你好,我说的removeComments不是在sale这个sample里面,是我自己的项目想要加上removeComments这个选项,上面是我的配置,像这样如果在HtmlWebpackPlugin里面设置minify的removeComments为true,那么<--shell -->会被清除掉,SkeletonPlugin在做replace操作的时候会找不到,所以我把这个minify{removeComments}选项移到了SkeletonPlugin里面,这个时候replace成功,但是问题是最后经过SkeletonPlugin输出的html并没有removeComments?是不是我哪里做错了,新手。。

Jocs commented 6 years ago

@imhangoo 不能够添加 removeComments, 这样会把 <!-- shell -->,remove 掉,所以暂时不能够添加 removeComments

hangoocn commented 6 years ago

恩 不过好像在SkeletonPlugin里面设置minify选项不会起作用。。

hangoocn commented 6 years ago

如果我想把最后输出的skeleton screen minify一下怎么办啊, 比如removeComments。。。这个是minify选项的一个option,好像设置minify的其他选项也不起作用,输出的都是formated的。。

Jocs commented 6 years ago

@imhangoo page-skeleton-webpack-plugin 支持 minify 配置选项的。你可以参考下文档。

hangoocn commented 6 years ago

我刚刚试着设置了sale sample里面的minify选项,但是通过npm run build 出来的dist里面的html并不是minify的。。

hooir-dev commented 5 years ago

您好,您是怎么解决这个问题的

hooir-dev commented 5 years ago

你好,我的意思是如果我本身想要在我自己项目里面开启html-webpack-plugin的removeComents,那么是不是会和page-skeleton-webpack-plugin有冲突?有没有办法让它先取代完了再去removeComments啊

您怎么解决的,谢谢啊