strip-css-comments

WebJar for strip-css-comments

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.npm
Идентификатор

Идентификатор

strip-css-comments
Последняя версия

Последняя версия

3.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

strip-css-comments
WebJar for strip-css-comments
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/sindresorhus/strip-css-comments

Скачать strip-css-comments

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.npm/strip-css-comments/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>strip-css-comments</artifactId>
    <version>3.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/strip-css-comments/
implementation 'org.webjars.npm:strip-css-comments:3.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/strip-css-comments/
implementation ("org.webjars.npm:strip-css-comments:3.0.0")
'org.webjars.npm:strip-css-comments:jar:3.0.0'
<dependency org="org.webjars.npm" name="strip-css-comments" rev="3.0.0">
  <artifact name="strip-css-comments" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='strip-css-comments', version='3.0.0')
)
libraryDependencies += "org.webjars.npm" % "strip-css-comments" % "3.0.0"
[org.webjars.npm/strip-css-comments "3.0.0"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
org.webjars.npm : is-regexp jar [1.0.0,2)

Модули Проекта

Данный проект не имеет модулей.

strip-css-comments

Strip comments from CSS

Also available as a Gulp/Grunt/Broccoli plugin.

Usage

$ npm install strip-css-comments

Usage

const stripCssComments = require('strip-css-comments');

// By default important comments `/*!` are preserved
stripCssComments('/*! <copyright> */ body { /* unicorns */color: hotpink; }');
//=> '/*! <copyright> */ body { color: hotpink; }'

// `preserve: false` will strip all comments including `/*!`
stripCssComments(
	'/*! <copyright> */ body { /* unicorns */color: hotpink; }',
	{preserve: false}
);
//=> 'body { color: hotpink; }'

// Preserve comments based on a regex
stripCssComments(
	'/*# preserved */ body { /* unicorns */color: hotpink; }',
	{preserve: /^#/}
);
//=> '/*# preserved */ body { color: hotpink; }'

// Preserve comments based on the return value of the supplied function
stripCssComments(
	'/*# preserved */ body { /* unicorns */color: hotpink; }',
	{
		preserve: comment => comment.charAt(0) === '#'
	}
);
//=> '/*# preserved */ body { color: hotpink; }'

API

stripCssComments(cssString, options?)

cssString

Type: string

String with CSS.

options

Type: object

preserve

Type: boolean | RegExp | Function
Default: true

  • true - Preserve important comments /*! */.
  • false - Strip all comments.
  • RegExp - Preserve comments where the comment body matches a regular expression.
  • Function - Preserve comments for which a function returns true. The function is called on each comment, gets the comment body as the first argument, and is expected to return a boolean of whether to preserve the comment.

whitespace

Type: boolean
Default: true

Replace comments with whitespace instead of stripping them entirely.

Benchmark

$ npm run bench

Related

Версии библиотеки

Версия
3.0.0