惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

F
Full Disclosure
Stack Overflow Blog
Stack Overflow Blog
H
Help Net Security
Microsoft Azure Blog
Microsoft Azure Blog
The GitHub Blog
The GitHub Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Recorded Future
Recorded Future
Y
Y Combinator Blog
Cloudbric
Cloudbric
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
S
Schneier on Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
C
Cybersecurity and Infrastructure Security Agency CISA
TaoSecurity Blog
TaoSecurity Blog
Security Latest
Security Latest
N
News and Events Feed by Topic
Hacker News - Newest:
Hacker News - Newest: "LLM"
D
DataBreaches.Net
Security Archives - TechRepublic
Security Archives - TechRepublic
H
Hacker News: Front Page
C
Cisco Blogs
L
LangChain Blog
aimingoo的专栏
aimingoo的专栏
Recent Commits to openclaw:main
Recent Commits to openclaw:main
V
Vulnerabilities – Threatpost
L
LINUX DO - 最新话题
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
A
About on SuperTechFans
www.infosecurity-magazine.com
www.infosecurity-magazine.com
Jina AI
Jina AI
C
CXSECURITY Database RSS Feed - CXSecurity.com
Schneier on Security
Schneier on Security
T
Tenable Blog
N
News and Events Feed by Topic
W
WeLiveSecurity
有赞技术团队
有赞技术团队
AI
AI
爱范儿
爱范儿
大猫的无限游戏
大猫的无限游戏
Latest news
Latest news
T
The Blog of Author Tim Ferriss
S
Security Affairs
Know Your Adversary
Know Your Adversary
Simon Willison's Weblog
Simon Willison's Weblog
G
GRAHAM CLULEY
Google DeepMind News
Google DeepMind News
The Cloudflare Blog

Sass Blog

Sass: LibSass Has Reached End-Of-Life Sass: Request for Comments: Indented Syntax Improvements Sass: `@import` is Deprecated Sass color spaces & wide gamut colors Sass: Node Sass is end-of-life
Sass: Announcing `pkg:` Importers
Natalie Weiz · 2024-02-16 · via Sass Blog

Posted 16 February 2024 by Natalie Weizenbaum

Several months ago, we asked for feedback on a proposal for a new standard for importers that could load packages from various different package managers using the shared pkg: scheme, as well as a built-in pkg: importer that supports Node.js’s module resolution algorithm. Today, I’m excited to announce that this feature has shipped in Dart Sass 1.71.0!

No longer will you have to manually add node_modules to your loadPaths option and worry about whether nested packages will work at all. No longer will you need to add ~s to your URLs and give up all portability. Now you can just pass importers: [new NodePackageImporter()] and write @use 'pkg:library' and it’ll work just how you want out of the box.

What is a pkg: importer?What is a pkg: importer? permalink

Think of a pkg: importer like a specification that anyone can implement by writing a custom importer that follows a few rules. We’ve implemented one for the Node.js module algorithm, but you could implement one that loads Sass files from RubyGems or PyPI or Composer. This way, a Sass file doesn’t have to change the URLs it loads no matter where it’s loading them from.

What do pkg: URLs look like?What do pkg: URLs look like? permalink

The simplest URL is just pkg:library. This will find the library package in your package manager and load its primary entrypoint file, however that’s defined. You can also write pkg:library/path/to/file, in which case it will look for path/to/file in the package’s source directory instead. And as with any Sass importer, it’ll do the standard resolution to handle file extensions, partials, and index files.

How do I publish an npm package that works with the Node.js pkg: importer?How do I publish an npm package that works with the Node.js pkg: importer? permalink

The Node.js pkg: importer supports all the existing conventions for declaring Sass files in package.json, so it should work with existing Sass packages out of the box. If you’re writing a new package, we recommend using the "exports" field with a "sass" key to define which stylesheet to load by default:

{
  "exports": {
    "sass": "styles/index.scss"
  }
}

The Node.js pkg: importer supports the full range of "exports" features, so you can also specify different locations for different subpaths:

{
  "exports": {
    ".": {
      "sass": "styles/index.scss",
    },
    "./button.scss": {
      "sass": "styles/button.scss",
    },
    "./accordion.scss": {
      "sass": "styles/accordion.scss",
    }
  }
}

…or even patterns:

{
  "exports": {
    ".": {
      "sass": "styles/index.scss",
    },
    "./*.scss": {
      "sass": "styles/*.scss",
    },
  }
}