Vue CLI 运行单独的 CSS 构建吗?
我正在尝试对特定文件运行完全独立的 css/sass 构建。
所以我的 src 中有一个文件夹,例如:
/src
/sass
./index.sass
./btn.sass
./etc.sass
我试图将其输出到特定文件,例如“build.css”或任何最终会在“dist”的默认构建目录中作为“dist/build”的文件.css”。
一直在尝试使用 vue.config.js 和 chainWebpack,但在这里完全迷失了。
有什么建议如何实现这一点吗?
I'm trying to run a completely separate css/sass build to a specific file.
So I have a folder in my src like:
/src
/sass
./index.sass
./btn.sass
./etc.sass
I'm trying to get it to output to a specific file like "build.css" or whatever which would just end up in the default build directory of "dist" as "dist/build.css".
Been trying to play with vue.config.js and chainWebpack but totally lost here.
Any suggestions how to accomplish this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一种方法是添加一个指向要捆绑的 Sass 文件的 Webpack
entry
(使用configureWebpack.entry
):One way to do this is to add a Webpack
entry
that points to the Sass file you want to bundle (usingconfigureWebpack.entry
):This has a downside as it also generates a
.js
file that is effectively a no-op. You'd have to delete that manually as a cleanup step:Also delete the
<script src="/js/extCss.js"></script>
fromdist/index.html
.