Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
svelte-preprocess
Advanced tools
A Svelte preprocess wrapper with baked in support for some preprocessors
svelte-preprocess is a versatile preprocessor for Svelte that allows you to use various languages and tools in your Svelte components. It supports languages like TypeScript, SCSS, Less, and PostCSS, among others, and can be configured to handle multiple preprocessors simultaneously.
TypeScript
Allows you to write your Svelte component scripts in TypeScript, providing type safety and other TypeScript features.
<script lang="ts">
let message: string = 'Hello, TypeScript!';
</script>
SCSS
Enables you to use SCSS for styling your Svelte components, allowing for variables, nesting, and other SCSS features.
<style lang="scss">
$primary-color: #ff3e00;
h1 {
color: $primary-color;
}
</style>
PostCSS
Allows you to use PostCSS with your Svelte components, enabling features like Tailwind CSS and other PostCSS plugins.
<style lang="postcss">
:global(body) {
@apply bg-gray-100;
}
</style>
Pug
Enables you to use Pug (formerly Jade) for your Svelte component templates, providing a more concise syntax for writing HTML.
<template lang="pug">
h1 Hello, Pug!
</template>
Less
Allows you to use Less for styling your Svelte components, providing features like variables and mixins.
<style lang="less">
@primary-color: #ff3e00;
h1 {
color: @primary-color;
}
</style>
A Svelte preprocessor that focuses on TypeScript support. It provides a more streamlined experience for TypeScript users but lacks the broader range of preprocessing options available in svelte-preprocess.
A magical and customizable Svelte preprocessor with support for: SCSS, Less, Stylus, Coffeescript and Pug.
const svelte = require('svelte')
const magicalPreprocess = require('svelte-preprocess')
const magicOpts = {
/** Transform the whole markup before preprocessing */
onBefore({ content,filename }) {
return content.replace('something', 'someotherthing')
},
languages: {
/** Disable a language by setting it to 'false' */
scss: false,
/** Pass options to the default preprocessor an object */
stylus: {
paths: ['node_modules']
},
/** Use a custom preprocess method by passing a function. */
pug(content, filename) {
const code = pug.render(content)
return { code, map: null }
}
}
}
svelte.preprocess(input, magicalPreprocess(magicOpts)).then(...)
<template>
<div>Hey</div>
</template>
<style></style>
<script></script>
<template src="template.html"></template>
<script src="./script.js"></script>
<style src="./style.css"></style>
Current supported out-of-the-box preprocessors are SCSS
, Stylus
, Less
, Coffeescript
, Pug
.
<div>Hey</div>
<style src="./style.scss"></style>
<style src="./style.styl"></style>
<style lang="scss">
$color: red;
div {
color: $color;
}
</style>
<style type="text/stylus">
$color = red
div
color: $color
</style>
FAQs
A Svelte preprocessor wrapper with baked-in support for commonly used preprocessors
The npm package svelte-preprocess receives a total of 259,999 weekly downloads. As such, svelte-preprocess popularity was classified as popular.
We found that svelte-preprocess demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 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.
Security News
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.