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

Hoy to use npm packages with no css in "main" but "style" defined? #95

Open
YerkoPalma opened this issue Sep 26, 2016 · 1 comment
Open

Comments

@YerkoPalma
Copy link

I have the following problem. I'm using two npm packages that use css defined on their package.json files. The first one, tachyons, defines in the main and style section a path to the css. The second one, leaflet, define a js file in his main section and a css file in his style section. When I use them with sheetify, tachyons work, but leaflet fails. I'm using it like this.

const sf = require('sheetify')

sf('tachyons', { global: true })
sf('leaflet', { global: true })

That result in

Error: Cannot find module 'leaflet' from '/home/yerko/Dev/partes/src' while parsing file: /home/yerko/Dev/partes/src/app.js

So, am I doing it wrong? or should sheetify recognize leaflet css file?

@bcomnes
Copy link
Contributor

bcomnes commented Oct 2, 2016

An alternative is to use require.resolve to get the correct base path of the module folder you want, modify the path to point to the correct css file, and pass that path to sheetify as if it were a local css file. Note, that this will default to a non-global css insert so turn that on if you want to not prefix it. You can also send a PR to add the correct stylesheet export to the package.json in some cases.

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

No branches or pull requests

2 participants