simply-beautiful

1.0.1 • Public • Published




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

Option 1: 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');

Option 2: 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! :)

Package Sidebar

Install

npm i simply-beautiful

Weekly Downloads

988

Version

1.0.1

License

MIT

Unpacked Size

158 kB

Total Files

7

Last publish

Collaborators

  • itwcw2000