GithubHelp home page GithubHelp logo

Comments (6)

wangyewei avatar wangyewei commented on May 21, 2024

在项目中使用时,样式文件需要手动引入,不会自动引入。如果不想打包单个组件的样式,简单方法可以在rollup.config.js中的externalConfig进行配置。且不建议将这个项目用在实际生产中...

from design-06k4.

xiaoshan100 avatar xiaoshan100 commented on May 21, 2024

我的意思是打包后,每个组件的文件里面都有对应的样式文件了,而不是像现在这样 不需要再去手动全部引入一次总的样式文件,比如我只想用一个组件 就只用这一个组件的样式 不需要额外引入全部组件的样式

from design-06k4.

cuiliangl avatar cuiliangl commented on May 21, 2024

我的意思是打包后,每个组件的文件里面都有对应的样式文件了,而不是像现在这样 不需要再去手动全部引入一次总的样式文件,比如我只想用一个组件 就只用这一个组件的样式 不需要额外引入全部组件的样式

我也想这样,有好的方案吗?
期望打包后的目录结构类似于ant 组件库这样的
image

from design-06k4.

wangyewei avatar wangyewei commented on May 21, 2024

我的意思是打包后,每个组件的文件里面都有对应的样式文件了,而不是像现在这样 不需要再去手动全部引入一次总的样式文件,比如我只想用一个组件 就只用这一个组件的样式 不需要额外引入全部组件的样式

See: https://github.com/wangyewei/design-06k4/blob/Devlopment-Version/scripts/build-css.js

from design-06k4.

cuiliangl avatar cuiliangl commented on May 21, 2024

我的意思是打包后,每个组件的文件里面都有对应的样式文件了,而不是像现在这样 不需要再去手动全部引入一次总的样式文件,比如我只想用一个组件 就只用这一个组件的样式 不需要额外引入全部组件的样式

See: https://github.com/wangyewei/design-06k4/blob/Devlopment-Version/scripts/build-css.js

我找到解决方式了,一种是自己写了rollup插件,跟你这个差不多,自己编译scss。另一种是把每个组件作为独立入口,这个一开始尝试过,问题是css还是全部打成一个,没有独立拆分。最后发现需要独立配置打包目录,因为css是和js打到同级的。

from design-06k4.

wangyewei avatar wangyewei commented on May 21, 2024

我的意思是打包后,每个组件的文件里面都有对应的样式文件了,而不是像现在这样 不需要再去手动全部引入一次总的样式文件,比如我只想用一个组件 就只用这一个组件的样式 不需要额外引入全部组件的样式

See: https://github.com/wangyewei/design-06k4/blob/Devlopment-Version/scripts/build-css.js

我找到解决方式了,一种是自己写了rollup插件,跟你这个差不多,自己编译scss。另一种是把每个组件作为独立入口,这个一开始尝试过,问题是css还是全部打成一个,没有独立拆分。最后发现需要独立配置打包目录,因为css是和js打到同级的。

编写Rollup插件听起来不错,感兴趣的话欢迎提交pr!

from design-06k4.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.