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

为什么打包后Css 没有打包成一个文件? #60

Closed
cybibo opened this issue Sep 5, 2017 · 3 comments
Closed

为什么打包后Css 没有打包成一个文件? #60

cybibo opened this issue Sep 5, 2017 · 3 comments

Comments

@cybibo
Copy link

cybibo commented Sep 5, 2017

这是我打包后的源码:

<title>manage-system</title>
<script src="./static/js/vendor.dll.js"></script> <script type="text/javascript" src="/app.js"></script>

这是你线上(http://open.omwteam.com/work/#/login)打包后的源码:

<title>manage-system</title>
<script type=text/javascript src=./static/js/manifest.5e485a363fe34070cff2.js></script> <script type=text/javascript src=./static/js/vendor.b7f323ffc6b03b5d803f.js></script> <script type=text/javascript src=./static/js/app.42d94365fe1a11281cba.js></script>

我也想打包成如你线上的源码,我在webpack配置里怎么改?
 

@lin-xin
Copy link
Owner

lin-xin commented Sep 5, 2017

@cybibo 请参考 lin-xin/blog#10

@cybibo
Copy link
Author

cybibo commented Sep 6, 2017

不好意思,我还是没找到如何把CSS打包成一个CSS的解决办法,在webpack.prod.conf.js里有
new ExtractTextPlugin({
filename: utils.assetsPath('css/[name].[contenthash].css')
}),
但运行npm run build之后,打包后的列表没看到生成css文件。

@lin-xin
Copy link
Owner

lin-xin commented Sep 6, 2017

抱歉我上面误解你的意思了。

写在 .vue 文件里的用 style标签写的css ,打包后会以 style 标签在 head 插入。通过 import css 文件,则会把文件打包成一个css文件在head引入。你看你是怎么写的呢!

@lin-xin lin-xin closed this as completed Nov 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants