Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

css-scaffolder

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-scaffolder - npm Package Compare versions

Comparing version 0.1.2 to 0.2.0

dist/reset.d.ts

7

dist/extract.d.ts

@@ -1,1 +0,6 @@

export declare function extract(htmlString: string): string;
interface ExtractOptions {
ignorePatternForSingleClass?: RegExp;
reset?: boolean;
}
export declare function extract(htmlString: string, options?: ExtractOptions): string;
export {};

@@ -10,2 +10,3 @@ "use strict";

var utils_1 = require("./utils");
var reset_1 = require("./reset");
function getAttribute(el, attrName) {

@@ -26,3 +27,4 @@ for (var i = 0; i < el.attrs.length; i += 1) {

}
function extract(htmlString) {
function extract(htmlString, options) {
if (options === void 0) { options = {}; }
var selectors = [];

@@ -58,2 +60,7 @@ var selectorFlag = new Map();

utils_1.combination(classNames.length, i).forEach(function (index) {
if (index.length === 1 &&
options.ignorePatternForSingleClass &&
options.ignorePatternForSingleClass.test(classNames[index[0]])) {
return;
}
var selector = index.map(function (cn) { return "." + classNames[cn]; }).join('');

@@ -68,5 +75,11 @@ addSelector(selector, el);

fragment.childNodes.forEach(function (el) { return retrieveClassNames(el); });
var css = selectors.map(function (selector) { return selector.selector + " {" + (selector.style || '') + "}"; }).join('\n\n');
var css = selectors
.map(function (selector) {
var styleAttribute = selector.style || '';
var defaultStyle = options.reset ? reset_1.reset(selector.tagName) : '';
return selector.selector + " {" + defaultStyle + styleAttribute + "}";
})
.join('\n\n');
return standalone_1.format(css, { parser: 'css', plugins: [parser_postcss_1.default] });
}
exports.extract = extract;

2

package.json
{
"name": "css-scaffolder",
"version": "0.1.2",
"version": "0.2.0",
"description": "Scaffold CSS declarations from HTML",

@@ -5,0 +5,0 @@ "scripts": {

# CSS Scaffolder
Scaffold CSS declarations from HTML
[Demo](https://css-scaffolder.netlify.com/)
## License
MIT
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc