微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

node.js – package.json中的“样式”字段

我注意到 BootstrapNormalize.css在其package.json中都有一个“样式”字段.

为什么他们有这个?如果我不得不猜测,那就是允许用户像所要求的那样轻松地导入定义的样式表(‘bootstrap’),但实际上并不是这样.

解决方法

从Techwraith的 pull request添加到Bootstrap:

Many modules in npm are starting to expose their css entry files in
their package.json files. This allows tools like 07001,
07002,and 07003 to import bootstrap from the
node_modules directory. […]

It’s actually not written anywhere but in the code for these modules
right Now. We’re hoping to get this standardized at some point,but
we’ve all reached this convention separately,so I’m inclined to just
go with it. […]

If you want to read about this style of css development,I wrote a
thing:

07004

还有其他工具支持,如browserify插件parcelify

Add css to your npm modules consumed with browserify.

  • Just add a style key to your package.json to specify the package’s css file(s). […]

Parcelify will concatenate all the css files in the modules on which
main.js depends — in this case just myModule.css — in the order
of the js dependency graph,and write the output to bundle.css.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐