You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Default behavior: Check whether the file exists when imported relative to original file. If yes, use this file. For example: /client/css/@ryan/something.scss
Default behavior: Sass happened to have something called partial files: if you @import "something", it also resolves to _something.scss. Therefore we need to look up whether partial files exist during relative import... For example: /client/css/@ryan/_something.scss
Default behavior: Sass also import normal CSS file when import does NOT end with .scss extension. Look it up relatively. For example: /client/css/@ryan/something.css
Custom instapack behavior: Check whether the file exists when imported relative to original file, but as index.scss in a folder. Disable this behavior when the import ends with .scss extension. For example: /client/css/@ryan/something/index.scss
Custom instapack behavior: Check whether the file exists when imported relative to original file, but as index.css in a folder. Disable this behavior when the import ends with .scss extension. For example: /client/css/@ryan/something/index.css
Legacy instapack behavior: Check whether the file exists when imported relative to node_modules as SCSS file. If yes, use this file. For example: /node_modules/@ryan/something.scss
Legacy instapack behavior: Check whether the file exists when imported relative to node_modules as partial file. If yes, use this file. For example: /node_modules/@ryan/_something.scss
Legacy instapack behavior: Check whether the file exists when imported relative to node_modules as CSS file. If yes, use this file. For example: /node_modules/@ryan/something.css
Custom instapack behavior: Check whether package.json exists in the imported node_modules package folder. If yes, try to parse the sass and style fields. Disable this behavior when the import ends with .scss extension. For example: /node_modules/@ryan/something/package.json
If sass field exists and the file actually exists (when resolved relative to the package.json), use this file.
Else, if the style field exists and the file actually exists (when resolved relative to the package.json), use this file instead.
If no result so far, then the imported file is not found. Should probably throw an error.
EDIT: Partial import from node_modules (8) will be disabled to prevent questionable / janky AF resolution. Explicit is good in this one case...
EDIT 2:node_modules imports are evaluated after normal imports to prevent unwanted behaviors unlike the default Sass behaviors.
The text was updated successfully, but these errors were encountered:
https://jaketrent.com/post/package-json-style-attribute/
Apparently nowadays there is a
style
field inpackage.json
pointing to CSS file to be imported, just likemain
field for JS file:https://github.com/twbs/bootstrap/blob/v4-dev/package.json
https://github.com/Semantic-Org/Semantic-UI/blob/master/package.json
https://github.com/uikit/uikit/blob/develop/package.json
https://github.com/FortAwesome/Font-Awesome/blob/fa-4/package.json
We have the technology to redirect package imports using
node-sass
importer function: https://github.com/sass/node-sassSpecifications
For example, from
/client/css/index.scss
Disable the existing
node_modules
folder resolution first.Default behavior: Check whether the file exists when imported relative to original file. If yes, use this file. For example:
/client/css/@ryan/something.scss
Default behavior: Sass happened to have something called partial files: if you
@import "something"
, it also resolves to_something.scss
. Therefore we need to look up whether partial files exist during relative import... For example:/client/css/@ryan/_something.scss
Default behavior: Sass also import normal CSS file when import does NOT end with
.scss
extension. Look it up relatively. For example:/client/css/@ryan/something.css
Custom instapack behavior: Check whether the file exists when imported relative to original file, but as
index.scss
in a folder. Disable this behavior when the import ends with.scss
extension. For example:/client/css/@ryan/something/index.scss
Custom instapack behavior: Check whether the file exists when imported relative to original file, but as
index.css
in a folder. Disable this behavior when the import ends with.scss
extension. For example:/client/css/@ryan/something/index.css
Legacy instapack behavior: Check whether the file exists when imported relative to
node_modules
as SCSS file. If yes, use this file. For example:/node_modules/@ryan/something.scss
Legacy instapack behavior: Check whether the file exists when imported relative tonode_modules
as partial file. If yes, use this file. For example:/node_modules/@ryan/_something.scss
Legacy instapack behavior: Check whether the file exists when imported relative to
node_modules
as CSS file. If yes, use this file. For example:/node_modules/@ryan/something.css
Custom instapack behavior: Check whether
package.json
exists in the importednode_modules
package folder. If yes, try to parse thesass
andstyle
fields. Disable this behavior when the import ends with.scss
extension. For example:/node_modules/@ryan/something/package.json
If
sass
field exists and the file actually exists (when resolved relative to thepackage.json
), use this file.Else, if the
style
field exists and the file actually exists (when resolved relative to thepackage.json
), use this file instead.If no result so far, then the imported file is not found. Should probably throw an error.
EDIT: Partial import from
node_modules
(8) will be disabled to prevent questionable / janky AF resolution. Explicit is good in this one case...EDIT 2:
node_modules
imports are evaluated after normal imports to prevent unwanted behaviors unlike the default Sass behaviors.The text was updated successfully, but these errors were encountered: