Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
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.
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 researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.