@3yourmind/sass-node-modules-importer 中文文档教程

发布于 3年前 浏览 20 项目主页 更新于 3年前

@3yourmind/sass-node-modules-importer

node_modules sass

Usage

`rollup.config.js 导入器:

import sassNodeModulesImporter from '@3yourmind/sass-node-modules-importer'
import scss from 'rollup-plugin-scss'

export default [
    scss({
        // passed directly to sass
        importer: sassNodeModulesImporter(),
        importer: sassNodeModulesImporter({ debug: true }),
        importer: sassNodeModulesImporter({ start: '~' }),
    }),
]
@import '~normalize.css/'; // Trailing slash is important if module ends with .css as sass will not call the importer otherwise

Supported Sources

  • (recursive) parent node_modules
  • package.json style property
  • files ending with importExtensions
  • index.css

Options

namedefaulttypedescription
debugfalsebooleanEnable debug logs
indexExtensions['.css', '.sass', '.scss']string[]Extensions to resolve when extension is omitted. Will prefer based on order.
start~stringPrefix string/char to refer to node_modules folders

@3yourmind/sass-node-modules-importer

node_modules importer for sass

Usage

`rollup.config.js:

import sassNodeModulesImporter from '@3yourmind/sass-node-modules-importer'
import scss from 'rollup-plugin-scss'

export default [
    scss({
        // passed directly to sass
        importer: sassNodeModulesImporter(),
        importer: sassNodeModulesImporter({ debug: true }),
        importer: sassNodeModulesImporter({ start: '~' }),
    }),
]
@import '~normalize.css/'; // Trailing slash is important if module ends with .css as sass will not call the importer otherwise

Supported Sources

  • (recursive) parent node_modules
  • package.json style property
  • files ending with importExtensions
  • index.css

Options

namedefaulttypedescription
debugfalsebooleanEnable debug logs
indexExtensions['.css', '.sass', '.scss']string[]Extensions to resolve when extension is omitted. Will prefer based on order.
start~stringPrefix string/char to refer to node_modules folders
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文