css-modules / css-modulesify

A browserify plugin to load CSS Modules
MIT License
403 stars 47 forks source link

how to use it like css-loader #109

Open wujohns opened 7 years ago

wujohns commented 7 years ago

when using css-loader the css style which is required will be writen in a style tag. But using css-modulesify needs to set the param 'output' to modify the css file path. Is there anyway to write the css complied by css-modulesify into the style tag when the target page loaded

joshwnj commented 7 years ago

@wujohns not at present - however this wouldn't be a difficult feature to add :) Let me know if you'd like to try making a PR, and I'll be very happy to assist you if you get stuck.

wujohns commented 7 years ago

@joshwnj thank you, I will try making the PR — —×, But it maybe take me a few weeks

joshwnj commented 7 years ago

@wujohns go for it! :) and let me know if you need a hand at any point

wujohns commented 7 years ago

@joshwnj There is little document about how to build the browserify plugin. I do some try to understand the code of css-modulesify but get little effect. I need some links or keywords about building browserify plugin(like how to insert code into the browserify stream). I write a learning project and try to get it

wujohns commented 7 years ago

Form the cmify.js, I get that you custom the method '_transform' and ' _flush' of stream to build the transform for browserify. I just find the introduction in the nodejs apis document. I think the point to make headway is testing it (stream.tranform). So I want to finish the plugin building learning at first

wujohns commented 7 years ago

@joshwnj I create a pr about it just now.After learn the knowlege about it,I found the project is kind of messed,if you have a plan to rewrite some part of this project I am pleasure to help it.(like eslint,Cmify...)

wujohns commented 7 years ago

Learning browserify‘s plugin building and this project(includ projects it depends) take a lot of time. And I have a plan to write a new project to support less in js(maybe: less-modulify).There are two choices about it: 1.transform less to css then use css-modulify 2.write a less plugin (something like postcss-scope) and make it independent If you have any idea about it.Please tell me :)

joshwnj commented 7 years ago

I create a pr about it just now.

Awesome, I'll take a look

After learn the knowlege about it,I found the project is kind of messed,if you have a plan to rewrite some part of this project I am pleasure to help it.

you're right, there are some pretty messy parts :) I am hoping to do a rewrite and major-version-bump some time soon, so your help will be appreciated then, thanks.

I need some links or keywords about building browserify plugin(like how to insert code into the browserify stream).

Yeah, it was a while ago when I learned this, and so I don't recall exactly where I found the info. One good place to start is https://github.com/substack/browserify-handbook

In particular, read the sections about:

wujohns commented 7 years ago

Because of some working reason.I write a plugin for less and do some working for it to support css module and soucemap feature. the link is less-modulesify