Registry / web-framework / stylus-standalone

stylus-standalone

JSON →
library0.1.0jsnpmunverified

Stylus-standalone is a standalone browser-ready build of the Stylus CSS preprocessor, allowing you to compile Stylus code directly in the browser without Node.js or a build step. Version 0.1.0 is the initial release, and the package appears to be experimental with no further updates. It provides a single script tag inclusion via CDN, making it easy to experiment with Stylus in HTML. However, it lacks TypeScript definitions, active maintenance, and common developer tooling. Compared to the official stylus package, this is a minimal wrapper that exposes the compiler globally, suitable only for quick prototyping or educational use.

npm install stylus-standalone
INSTALL
IMPORT
SIG · STYLUS-STANDALONE
S
stylus-standalone
web-frameworkjavascriptv0.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

stylus
<!-- Include via script tag --> <script src="https://unpkg.com/stylus-standalone"></script> <!-- then use window.stylus -->
import stylus from 'stylus-standalone'
This package is not ESM-compatible; it exports a global stylus object.
stylus.render
stylus.render(str, options, callback)
stylus.render(str, options)
Callback is required; returns undefined.
stylus(str)
stylus(str).render(callback)
stylus(str).render()
The stylus function returns a Renderer instance with a .render method that takes a callback.

Demonstrates in-browser Stylus compilation using a script tag and the global stylus object with callback.

<!DOCTYPE html> <html> <head> <script src="https://unpkg.com/stylus-standalone"></script> </head> <body> <script> const stylusCode = ` body font-family sans-serif color #333 `; stylus.render(stylusCode, { compress: true }, (err, css) => { if (err) console.error(err); else { const style = document.createElement('style'); style.textContent = css; document.head.appendChild(style); } }); </script> </body> </html>
Debug
Known issues
gotchaThe package is not maintained and may not work with modern browsers.
fix
Consider using the official stylus package with a build tool.
affects: 0.1.0
breakingCallback-based API only; promises not supported.
fix
Wrap calls in a promise: new Promise((resolve, reject) => stylus.render(str, opts, (e,r) => e ? reject(e) : resolve(r)))
affects: 0.1.0
deprecatedPackage likely uses outdated stylus version and may have unpatched security issues.
fix
Use stylus package via npm instead.
affects: 0.1.0
Errors
Common errors & fixes
stylus is not defined
Script tag not loaded before usage.
fix
Ensure <script src="https://unpkg.com/stylus-standalone"></script> is placed before your code.
Cannot read property 'render' of undefined
Trying to use stylus as a function without proper invocation.
fix
Use stylus.render() directly, not stylus().render().
TypeError: callback is not a function
Missing callback argument in render call.
fix
Always provide a callback: stylus.render(str, opts, (err, css) => {...})
Upgrade
Version history
0.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
stylus-standalone — npm install stylus-standalone · libregistry