Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
css-to-ts takes css file and outputs TypeScript file with an exported string containing content of your css file.
Compiles css files to importable TypeScript files.
$ npm install css-to-ts -g
Global installation is not necessary. You can install this package with sh $ npm install css-to-ts
and use it in npm-scripts
.
$ css-to-ts -h
Argument | Type | Default | Description |
---|---|---|---|
-h, --help | boolean | false | Show help. |
-v, --version | boolean | false | Show current version. |
--rootDir | string | ./ | Specifies the root directory of input files. |
--outDir | string | ./ | Redirect output structure to the directory. |
--pattern | string | **/*.css | Files glob pattern. |
-w, --watch | boolean | false | Watch for changes of input files. |
--prefix | string | Prefix added to ouput file name. | |
--suffix | string | Suffix added to output file name. | |
--delimitter | string | - | Specifies delimitter for prefix and suffix. Required if one of these are set. |
--removeSource | boolean | false | Remove all source files specified by glob pattern. |
--header | string | Specifies header comment in generated TS file. | |
--cwd | string | process.cwd() | Specifies current working directory. |
$ css-to-ts --rootDir "./src" --outDir "./dist" --pattern "*.css" --header "File generated with css-to-ts"
Input file ./src/orange.css
:
.orange {
color: orange;
border: 1px solid yellow;
}
Generated ./dist/orange.ts
:
// File generated with css-to-ts
export var Orange = `.orange {
color: orange;
border: 1px solid yellow;
}`;
ConvertCssToTs(stringifiedCss: string, variableName: string, headerComment?: string): string
Takes stringified css and outputs TypeScript code with exported string containing content of your css file.
Usage:
import { ConvertCssToTs } from "css-to-ts";
Argument | Type | Required | Description |
---|---|---|---|
stringifiedCss | string | * | Stringified css to be exported in TypeScript file. |
variableName | string | * | Name of variable to be exported in TypeScript file. |
headerComment | string | Comment placed in the top of exported TypeScript file. |
new CssToTsConverter(tsDir, tsFileName, cssDir, cssFileName, varName, header, removeSource)
Compiles css files to importable TypeScript files.
Usage:
import { CssToTsConverter } from "css-to-ts";
const converter = new CssToTsConverter(
tsDir,
tsFileName,
cssDir,
cssFileName,
varName,
header,
removeSource
);
try {
await converter.Convert();
} catch(error) {
console.error(error);
}
Constructor argument | Type | Required | Description |
---|---|---|---|
tsDir | string | * | Directory of TypeScript file. |
tsFileName | string | * | File name of TypeScript file. |
cssDir | string | * | Directory of css file. |
cssFileName | string | * | File name of css file. |
varName | string | * | Name of variable to be exported in TypeScript file. |
header | string | Comment placed in the top of exported TypeScript file. | |
removeSource | boolean | Should css file be deleted after TypeScript file emmitted. |
Released under the MIT license.
FAQs
css-to-ts takes a css file and outputs a TypeScript file with an exported string containing a content of your css file.
The npm package css-to-ts receives a total of 674 weekly downloads. As such, css-to-ts popularity was classified as not popular.
We found that css-to-ts demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.