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

how to use it like css-loader #109

Open
wujohns opened this issue Dec 5, 2016 · 9 comments
Open

how to use it like css-loader #109

wujohns opened this issue Dec 5, 2016 · 9 comments

Comments

@wujohns
Copy link

wujohns commented Dec 5, 2016

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
Copy link
Member

joshwnj commented Dec 5, 2016

@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
Copy link
Author

wujohns commented Dec 6, 2016

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

@joshwnj
Copy link
Member

joshwnj commented Dec 6, 2016

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

@wujohns
Copy link
Author

wujohns commented Dec 12, 2016

@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
Copy link
Author

wujohns commented Dec 12, 2016

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
Copy link
Author

wujohns commented Jan 10, 2017

@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
Copy link
Author

wujohns commented Jan 10, 2017

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
Copy link
Member

joshwnj commented Jan 11, 2017

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:

  • writing your own transform
  • plugins
  • one of the places to explore to learn more about browserify is the pipeline. There is an example here and a description of the different stages of the pipeline. To learn more, you can hook into the various pipeline stages and inspect the data going through them to see how it is transformed at each step

@wujohns
Copy link
Author

wujohns commented Feb 6, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants