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

Define entry points in package.json #125

Merged
merged 1 commit into from
Mar 27, 2018
Merged

Define entry points in package.json #125

merged 1 commit into from
Mar 27, 2018

Conversation

MohannadNaj
Copy link
Contributor

Specifying the entry point will make this possible from a sass file:

@import "hover.css";

also solves #94

for the main property, from npm's documentation:

The main field is a module ID that is the primary entry point to your program. That is, if your package is named foo, and a user installs it, and then does require("foo"), then your main module's exports object will be returned.

for the style property, copying from this SO answer:


From Techwraith's pull request that added it to Bootstrap:

Many modules in npm are starting to expose their css entry files in
their package.json files. This allows tools like npm-css,
rework-npm, and npm-less to import bootstrap from the
node_modules directory. [...]

It's actually not written anywhere but in the code for these modules
right now. We're hoping to get this standardized at some point, but
we've all reached this convention separately, so I'm inclined to just
go with it. [...]

If you want to read about this style of css development, I wrote a
thing:

http://techwraith.com/your-css-needs-a-dependency-graph-too/

There's also support in other tools, such as the browserify plugin parcelify:

Add css to your npm modules consumed with browserify.

  • Just add a style key to your package.json to specify the package's css file(s). [...]

Parcelify will concatenate all the css files in the modules on which
main.js depends -- in this case just myModule.css -- in the order
of the js dependency graph, and write the output to bundle.css.

github.com/postcss/postcss-import still uses the style property

@IanLunn IanLunn merged commit 692c81d into IanLunn:master Mar 27, 2018
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

Successfully merging this pull request may close these issues.

2 participants