Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Commit

Permalink
Expose path to Draft.css for usage by CSS pre-processors
Browse files Browse the repository at this point in the history
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
  • Loading branch information
flarnie authored and facebook-github-bot committed Oct 18, 2017
1 parent 221b6dc commit d746237
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"PATENTS"
],
"main": "lib/Draft.js",
"style": "dist/Draft.css",
"repository": "facebook/draft-js",
"license": "BSD-3-Clause",
"scripts": {
Expand Down

0 comments on commit d746237

Please sign in to comment.