Socket
Socket
Sign inDemoInstall

astro-css-components

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

astro-css-components - npm Package Compare versions

Comparing version 0.3.1 to 0.4.0

pnpm-lock.yaml

8

library.js

@@ -9,4 +9,4 @@ import { getCSSForComponent } from "./utils.js"

function addComponentForURL(url, component) {
component = getCSSForComponent(component)
function addComponentForURL(url, component, minify) {
component = getCSSForComponent(component, minify)

@@ -28,4 +28,4 @@ if (!(url in componentLibrary)) {

function addGlobalComponent(component) {
component = getCSSForComponent(component)
function addGlobalComponent(component, minify) {
component = getCSSForComponent(component, minify)

@@ -32,0 +32,0 @@ const oldComponent = componentLibrary.global.findIndex((comp) => comp.name === component.name)

{
"name": "astro-css-components",
"version": "0.3.1",
"version": "0.4.0",
"description": "CSS Components for Astro",

@@ -25,3 +25,6 @@ "main": "index.js",

},
"homepage": "https://github.com/Princesseuh/astro-css-components#readme"
"homepage": "https://github.com/Princesseuh/astro-css-components#readme",
"dependencies": {
"csso": "^4.2.0"
}
}

@@ -116,2 +116,12 @@ # astro-css-components

#### minify
By adding this props, the CSS will be minified through [csso](https://github.com/css/csso)
**Example:**
```jsx
<CSSComponent minify register={{ name: "should-be-purple", content: ".should-be-purple {color: purple;}" }} />
```
### getForURL

@@ -118,0 +128,0 @@

import { readFileSync } from 'fs'
import csso from 'csso'
// If the user supplied a file instead of a string, let's load it up
function getCSSForComponent(component) {
function getCSSForComponent(component, minify) {
if (!component.content && component.contentFile) {

@@ -9,4 +10,11 @@ component.content = readFileSync(component.contentFile, "utf8")

if (minify) component.content = minifyCSS(component.content)
return { ...component }
}
function minifyCSS(css) {
return csso.minify(css).css
}
export { getCSSForComponent }

Sorry, the diff of this file is not supported yet

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