Skip to content
This repository has been archived by the owner on Sep 13, 2024. It is now read-only.

Add style property to package.json, allowing for easier imports. #978

Closed
wants to merge 2 commits into from

Conversation

davejtoews
Copy link
Contributor

@davejtoews davejtoews commented Nov 15, 2016

When installed via npm, a style property in package.json allows this module to be easily imported when using tools such as npm-sass or sass-module-importer.

Apparently the "style" key is not a standard, but it is a growing trend. Here's a StackOverflow thread on the subject: http://stackoverflow.com/questions/32037150/style-field-in-package-json

Add style property to package.json, allowing for easier imports.
@davejtoews davejtoews changed the title Update package.json Add style property to package.json, allowing for easier imports. Nov 15, 2016
Copy link

@Hackzzila Hackzzila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please merge this, it would make Bourbon installable with diamond :)

@tysongach
Copy link
Contributor

I’m hesitant to add non-standard fields…

Have these changes been tested with npm-sass and sass-module-importer?

@davejtoews
Copy link
Contributor Author

@tysongach Yes, I've tested with both. The same can be said for the similar PR I made on Neat.

@davejtoews
Copy link
Contributor Author

@tysongach I get your hesitation to use a non-standard field, but I'm not really seeing the downside. It shouldn't affect any projects that don't make use of it.

Bootstrap added "style" to package.json two and a half years ago. They chose to point to their compiled css file rather than a pre-processor source in order to support the majority use case. In the case of Bourbon, all your users are Sass users of course, so adding "style": "core/_bourbon.scss" should have no effect except to allow for easier use among a subset of your users.

@tysongach
Copy link
Contributor

but I'm not really seeing the downside.

I’m mostly concerned with maintenance. I know it’s just “one line”, but there are many of these “one lines” sprinkled throughout for other third-party integrations that we have to maintain when things change and break. Since it is not standardized, we can’t follow a systemized approach.

The fact that npm-sass and sass-module-importer both use style is likely a happy coincidence. If we did add a field, I’m more inclined to add a sass field because that is what Bourbon is: a collection of Sass partials. We don’t have any compiled CSS. But it seems that that would leave sass-module-importer out of the picture.

I totally see where you’re coming from, but it’s tough as a library to support “all the things” and strive to be bug-free.

@davejtoews
Copy link
Contributor Author

The fact that npm-sass and sass-module-importer both use style is likely a happy coincidence.

More than a coincidence, I think. npm-css, rework-npm, npm-less, parcelify, and as @Hackzzila suggested above diamond all use it too. Of course only the latter two apply to Sass.

Though not an official standard, there seems to be a lot of support for 'style'.

I’m more inclined to add a sass field because that is what Bourbon is: a collection of Sass partials. ... But it seems that that would leave sass-module-importer out of the picture.

I'll note that both npm-sass and sass-module importer support using a sass file for 'main' as well as for 'style'. I'm not sure how this would affect using Bourbon with other tools, but since as you point out Bourbon is a collection of Sass partials, there's something a bit illogical about having a javascript file as it's main.

@tysongach
Copy link
Contributor

there's something a bit illogical about having a javascript file as it's main.

Definitely, and it is something I’ve never really been happy with.

We used to set main to point to the primary Bourbon manifest Sass file, but people still had to manually set that path up. It might be time to revisit all of that, as a whole.

@Hackzzila
Copy link

I am in support of either a sass or style field. sass seems more logical, but style has more support. Overall I don't really care much, but I am leaning towards sass.

@davejtoews
Copy link
Contributor Author

davejtoews commented Feb 9, 2017

One last point in support of the style field. It's been flagged as a "nice-to-have" feature in webpack's css-loader to make use of it. If webpack picks it up (and adds it to sass-loader too) then i'd suggest it might as well be a standard.

@Hackzzila
Copy link

What is the status on this?

@tysongach
Copy link
Contributor

Thanks, @davejtoews, merged as c10f0bf.

@tysongach tysongach closed this Jun 23, 2017
@tysongach tysongach mentioned this pull request Oct 25, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants