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.
astro-base-document
Advanced tools
Provide sensible defaults for HTML base document. The goal is to reduce boilerplate when using multiple layouts in Astro projects.
Provide sensible defaults for HTML base document.
The goal is to reduce boilerplate when using multiple layouts in Astro projects.
pnpm i astro-base-document
In your layout component, for example ./src/layouts/Default.astro
:
---
import { Document, Body } from 'astro-base-document';
// ...
---
<!-- All properties are optional -->
<Document
id="test-base-rootDoc"
data-theme="default"
lang="en"
class:list={[`mode-${import.meta.env.MODE}`, 'my-class-html']}
>
<Fragment slot="head">
<!-- Things you can inject in `HEAD` -->
<style is:inline>
.some-class {
color: red;
}
</style>
</Fragment>
<Body slot="body" id="my-id" class:list={['my-class-body']}>
<!-- Things you can inject in `BODY` -->
<nav>My navbar</nav>
<!-- Your page content slot -->
<slot />
</Body>
</Document>
<!DOCTYPE html>
<html lang="es" class="some-class doby-doba js" id="the-id">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script>
// CRITICAL
// Add `js` class to `HTML` tag if JavaScript is enabled
(() => {
const root = document.documentElement;
root.classList.add('js');
})();
</script>
<style is:inline>
.some-class {
color: red;
}
</style>
</head>
<body class="other-class dabadi-dabada" id="much-id">
<nav>My navbar</nav>
<!-- Page content slot -->
<div>My page content</div>
</body>
</html>
The js
class is added to HTML
tag, critically.
That way, you can handle CSS for users with or without JS enabled
with .js &
/ :not(.js) &
SCSS selectors.
/// <reference types="astro/astro-jsx" />
export interface Props extends astroHTML.JSX.HTMLAttributes {
/**
* **Default**: `'en'`
* */
lang?: string;
/**
* Provides early JS detection for further CSS use
* by adding `js` class critically to HTML element.
*
* **Default**: `true`
* */
jsEnabledClass?: boolean;
/**
* **Default**: `null`
* */
redirectTo?: string | null;
}
Other projects:
github
→ ✅ GitHub
.remark
plugin for embedding remote / local Markdown or code snippets.FAQs
Provide sensible defaults for HTML base document. The goal is to reduce boilerplate when using multiple layouts in Astro projects.
The npm package astro-base-document receives a total of 2 weekly downloads. As such, astro-base-document popularity was classified as not popular.
We found that astro-base-document demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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.