posthtml-class-to-css-module
A posthtml plugin for removing tags
Last updated 5 years ago by scrum .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install posthtml-class-to-css-module 
SYNC missed versions from official npm registry.

class to css module

A posthtml A posthtml plugin for clone class to attribute css-module

Travis Build StatusAppVeyor Build Statusnodenpm versionDependency StatusXO code styleCoveralls status

npm downloadsnpm

Why?

The plugin for cloning classes in the attribute css-module when used together with posthtml-css-modules

Install

npm i -D posthtml posthtml-class-to-css-module

Note: This project is compatible with node v4+

Usage

import {readFileSync, writeFileSync} from 'fs';
import posthtml from 'posthtml';
import clone from 'posthtml-class-to-css-module';

const html = readFileSync('input.html', 'utf8');

posthtml()
    .use(clone())
    .process(html)
    .then(result => {
        writeFileSync('output.html', result.html);
    });

Returns the html with cloned classes in the attribute css-module

Example

input.html

<!DOCTYPE html>
<html>
    <head></head>
    <body class="class-for-body"></body>
</html>

output.html

<!DOCTYPE html>
<html>
    <head></head>
    <body class="class-for-body" css-module="class-for-body"></body>
</html>

Options

removeClass

Type: Boolean
Default: false
Description: Removes the class attribute after cloning the class value to an attribute css-module

LICENSE

MIT License (MIT)

Copyright (c) Ivan Demidov scrum@list.ru

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Current Tags

  • 0.1.3                                ...           latest (5 years ago)

5 Versions

  • 0.1.3                                ...           5 years ago
  • 0.1.2                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.0.2                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Maintainers (2)
Downloads
Total 275
Today 0
This Week 5
This Month 5
Last Day 0
Last Week 0
Last Month 6
Dependencies (1)
Dev Dependencies (28)
Dependents (0)
None

Copyright 2014 - 2021 © npmmirror.com |