-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expose path to Draft.css for usage by CSS pre-processors #566
Conversation
Interesting. What preprocessors work like this? (so we can test on our end and ensure we have some knowledge about what will and won't work) |
Typically anything built on top of https://github.com/postcss/postcss-import (of which there are a few). If you want to test the simplest is probably to just use |
I'm fine with this. @zpao, any concerns? |
Not sure why CI never finished - I think we could merge this if it's not too late. Adding it to my queue. |
PS - I might have trouble merging this because it's been open for so long. If @darobin you are able to rebase it onto master and force push, that should re-trigger CI and make it easier to merge. |
Hi — sorry, I no longer use draft-js or for that matter work in development. I don't have anything set up on this machine. It's a one-line change to |
Actually @flarnie, GitHub says it's mergeable without a hitch so you should be fine there. Just ignore CI (or kick it over in the Travis UI), this really shouldn't break tests. |
Agreed - the only hitch is that our scripts for pulling changes into the Facebook codebase may try to verify that CI is passing on the branch. If so then I'll make a new branch. Good luck with whatever you are doing now! :) 🌅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@flarnie is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@flarnie has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Internally I'm getting a merge conflict and unable to rebase it - our system expects that rebasing and conflict resolution will happen on Github, and I haven't been able to access this branch to rebase it. I'll just make a new PR with this change, hope that's ok. Credit goes to @darobin for this change, and sorry again it went so long without review. |
**what is the change?:** CREDIT TO @darobin for this change, originally made in facebookarchive#566 --- Some CSS pre-processors understand node_modules and are able to @import without requiring an absolute path. However, without assistance from the module all that they can resolve is its root directory. This leads to @import statements like the following: ``` @import "draft-js/dist/Draft.css"; ``` While this works, it requires internal knowledge of the package's layout. This requires digging around and if the layout changes, this breaks. These pre-processors also recognise a style field in package.json, which is the equivalent of main for CSS. This allows one to import thusly: ``` @import "draft-js"; ``` It's a small change, but it helps!
Summary: **what is the change?:** CREDIT TO darobin for this change, originally made in #566 --- Some CSS pre-processors understand node_modules and are able to import without requiring an absolute path. However, without assistance from the module all that they can resolve is its root directory. This leads to import statements like the following: ``` import "draft-js/dist/Draft.css"; ``` While this works, it requires internal knowledge of the package's layout. This requires digging around and if the layout changes, this breaks. These pre-processors also recognise a style field in package.json, which is the equivalent of main for CSS. This allows one to import thusly: ``` import "draft-js"; ``` It's a small change, but it helps! Closes #1442 Differential Revision: D6088534 fbshipit-source-id: fcede534a18620907adfb6a30391b9f722756e8c
Summary: **what is the change?:** CREDIT TO darobin for this change, originally made in facebookarchive/draft-js#566 --- Some CSS pre-processors understand node_modules and are able to import without requiring an absolute path. However, without assistance from the module all that they can resolve is its root directory. This leads to import statements like the following: ``` import "draft-js/dist/Draft.css"; ``` While this works, it requires internal knowledge of the package's layout. This requires digging around and if the layout changes, this breaks. These pre-processors also recognise a style field in package.json, which is the equivalent of main for CSS. This allows one to import thusly: ``` import "draft-js"; ``` It's a small change, but it helps! Closes facebookarchive/draft-js#1442 Differential Revision: D6088534 fbshipit-source-id: fcede534a18620907adfb6a30391b9f722756e8c
Summary
Some CSS pre-processors understand
node_modules
and are able to@import
without requiring an absolute path. However, without assistance from the module all that they can resolve is its root directory. This leads to@import
statements like the following:While this works, it requires internal knowledge of the package's layout. This requires digging around and if the layout changes, this breaks.
These pre-processors also recognise a
style
field inpackage.json
, which is the equivalent ofmain
for CSS. This allows one to import thusly:It's a small change, but it helps!