rotundasoftware / parcelify

Add css to your npm modules consumed with browserify.
MIT License
251 stars 20 forks source link

Is it possible to use parcelify outside the context of a node module? #35

Closed ichabodcole closed 9 years ago

ichabodcole commented 9 years ago

Probably easier to just explain this through my use case. I am working on a single page angular based app, that uses node/gulp/browserify/sass to build and server the app. I have an app directory with lots of components, each of which contains a js, scss, and html template file. Ideally I'd like to be able to use parcelify to handle the sass to css conversion and bundling when I require one of those components into another, at the end get a css files exported to my build directory. Can parcelify be used in this context? I ran into some issues on my first attempt, so I just want to confirm it's possible. Also, is it possible to require a css/scss file directly?

This is an illustration of the folder structure where all components are either directly required into the top level app file or into each other compositionally. --> app ----> comp1 ------> index.js ------> comp1.scss ------> index.html ----> comp2

dgbeck commented 9 years ago

Hi @ichabodcole !

It sounds like you are using parcelify as it is intended to be used. I don't see any red flags.

Also, is it possible to require a css/scss file directly?

Can you explain the use case a little more?

ichabodcole commented 9 years ago

Hey @dgbeck, I'm a dum dum, was just configuring it wrong with gulp ;). Posted a gulp-browserify-parcelify-example repo to help out future dum dums. https://github.com/ichabodcole/Gulp-Browserify-Parcelify

Is it possible to set the location of the css / scss files in the options obj vs the package json (just curious)?

dgbeck commented 9 years ago

Hi @ichabodcole ! No worries!

Is it possible to set the location of the css / scss files in the options obj vs the package json (just curious)?

I suppose you could pass a packageFilter to browserify to default the style key of your package objects, but I'd recommend just explicitly setting it in the package json file itself.