Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simply-beautiful

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simply-beautiful

Beautify HTML, JS, CSS, and JSON in the browser or in Node.js!

  • 0.2.16
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source




Site | NPM Module | GitHub Repo

simply-beautiful will beautify (pretty print) any web language including HTML, CSS, Javascript, and even JSON! Configure your own indent size and more!



Simply Beautiful Works in Node AND browser environments

Yes, this module works in both Node and browser environments, including compatibility with Webpack and Browserify!

Un-minify any of the following languages

  • HTML
  • CSS
  • Javascript
  • JSON

Install Simply Beautiful

Install via npm

Install with npm if you plan to use Simply Beautiful in a Node project or in the browser.

npm install simply-beautiful

If you plan to use simply-beautiful in a browser environment, you will probably need to use Webpack, Browserify, or a similar service to compile it.

const beautify = require('simply-beautiful');

Install via CDN

Install with CDN if you plan to use Simply Beautiful only in a browser environment.

<script src="https://cdn.jsdelivr.net/npm/simply-beautiful@latest/dist/index.min.js"></script>
<script type="text/javascript">
  var beautify = SimplyBeautiful(); // The script above exposes the global variable 'SimplyBeautiful'
</script>

Using Simply Beautiful

Via the npm module or the CDN

After you have followed the install step, you can start using simply-beautiful with your website or software!

var options = {
  indent_size: 2,
  // ...
}
console.log(beautify.html('<div><div><div></div></div></div>', options));
console.log(beautify.css('p { color: red; text-align: center; }', options));
console.log(beautify.js("function test() { (function() { console.log('Hello World!') }()); }", options));
console.log(beautify.json('{ "top": { "middle": { "bottom": 69 } } }', options));

Extending Capabilities

Options

Find a kitchen-sink example of the options you can supply to customize the output of the beautifier!

var options = {
  indent_size: 4,
  space_before_conditional: true,
  jslint_happy: true,
  max_char: 0,
}

What Can Simply Beautiful do?

Simply beautify will pretty print any HTML, CSS Javascript, or JSON and it works in both browser and Node.js environments! Based on this pen here.

Final Words

If you are still having difficulty, we would love for you to post a question to the Simply Beautiful issues page. It is much easier to answer questions that include your code and relevant files! So if you can provide them, we'd be extremely grateful (and more likely to help you find the answer!)

Projects Using this Library

Somiibo: A Social Media Bot with an open-source module library.
JekyllUp: A website devoted to sharing the best Jekyll themes.
Slapform: A backend processor for your HTML forms on static sites.
SoundGrail Music App: A resource for producers, musicians, and DJs.
Hammock Report: An API for exploring and listing backyard products.

Ask us to have your project listed! :)

Keywords

FAQs

Package last updated on 10 Jun 2024

Did you know?

Socket

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.

Install

Related posts

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