From d7462373f25ef5fecc64169c6c896193b3747025 Mon Sep 17 00:00:00 2001 From: Flarnie Marchan Date: Wed, 18 Oct 2017 10:48:51 -0700 Subject: [PATCH] Expose path to Draft.css for usage by CSS pre-processors Summary: **what is the change?:** CREDIT TO darobin for this change, originally made in https://github.com/facebook/draft-js/pull/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 https://github.com/facebook/draft-js/pull/1442 Differential Revision: D6088534 fbshipit-source-id: fcede534a18620907adfb6a30391b9f722756e8c --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index e6bf033f85..2e61dcee18 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "PATENTS" ], "main": "lib/Draft.js", + "style": "dist/Draft.css", "repository": "facebook/draft-js", "license": "BSD-3-Clause", "scripts": {