
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@emmetio/config
Advanced tools
This module provides resolver for config that can be passed to Emmet abbreviation expander as options
argument. The config may contain global, syntax- and project-specific preferences like output format or snippets and config resolver creates final options payload with proper preferences overrides.
Config is a JSON file that contains global, syntax- and projects specific preferences. Currently, Emmet distinct two types of abbreviations: markup
(for languages like HTML, XML, Slim etc.) and stylesheet
(CSS, SASS, Less etc.), each of them has different settings and usage semantics. In order to globally configure all markup and/or stylesheet abbreviations, use globals
key with markup
and stylesheet
subkeys accordingly:
{
"globals": {
"markup": {
"profile": {
// Output all tags in uppercase
"tagCase": "upper"
},
// Add custom snippets to all markup-based syntaxes
"snippets": {
"site-nav": "nav>ul.nav>li.nav-item"
}
},
"stylesheet": {
// Add custom snippets to all stylesheet-based syntaxes
"snippets": {
"black": "color: black"
}
}
}
}
For available options, see types.d.ts
file.
Sometimes you may want to add syntax-specific preferences. For example, you may want to customize SASS syntax with new snippets but don’t want to use them in CSS. In this case, you should use syntax
key and a syntax name as a subkey:
{
"syntax": {
"sass": {
// In syntax-specific config, `type` must be either "markup" or "stylesheet"
"type": "stylesheet",
"snippets": {
"inc": "@include"
}
}
}
}
Contents of syntax-specific config is the same as global config.
You may also want to configure Emmet specifically for a project. Use "project" top-level key with project ID as a subkey:
{
"project": {
"my-project1": {
// Use `globals` and `syntax` sections as described above
"globals": { ... },
"syntax": { ... }
}
}
}
Config resolver is a function that takes JSON config and params that identify current context: abbreviation type, syntax and project.
import { expand } from '@emmetio/expand-abbreviation';
import resolveConfig from '@emmetio/config';
// Obtain config JSON somehow
const config = readFile('emmet-config.json');
// Identify current context
const params = {
type: 'markup',
syntax: 'html',
project: 'my-project1'
};
const result = expand('ul>li', resolveConfig(config, params));
console.log(result);
Available context options:
type
: type of abbreviation, either markup
or stylesheet
.syntax
: syntax name, a subkey of syntax
section.project
: ID of project, a subkey of project
section.Config resolver will create a final options payload for abbreviation expander, depending on context params.
FAQs
Emmet config resolver
The npm package @emmetio/config receives a total of 282 weekly downloads. As such, @emmetio/config popularity was classified as not popular.
We found that @emmetio/config demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.