https://github.com/itw-creative-works/simply-beautiful
Beautify HTML, JS, CSS, and JSON in the browser or in Node.js!
https://github.com/itw-creative-works/simply-beautiful
beautify beautify-css beautify-html beautify-js beautify-json css html javascript js json prettify pretty pretty-print
Last synced: about 2 months ago
JSON representation
Beautify HTML, JS, CSS, and JSON in the browser or in Node.js!
- Host: GitHub
- URL: https://github.com/itw-creative-works/simply-beautiful
- Owner: itw-creative-works
- License: mit
- Created: 2019-10-08T04:53:46.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-06-19T22:00:10.000Z (about 1 year ago)
- Last Synced: 2025-03-30T00:31:38.496Z (3 months ago)
- Topics: beautify, beautify-css, beautify-html, beautify-js, beautify-json, css, html, javascript, js, json, prettify, pretty, pretty-print
- Language: JavaScript
- Homepage: https://itwcreativeworks.com
- Size: 142 KB
- Stars: 10
- Watchers: 1
- Forks: 3
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
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](https://www.npmjs.com/package/webpack) and [Browserify](https://www.npmjs.com/package/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.
```shell
npm install simply-beautiful
```
If you plan to use `simply-beautiful` in a browser environment, you will probably need to use [Webpack](https://www.npmjs.com/package/webpack), [Browserify](https://www.npmjs.com/package/browserify), or a similar service to compile it.```js
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.
```htmlvar beautify = SimplyBeautiful(); // The script above exposes the global variable 'SimplyBeautiful'
```
## ⚡️ 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!
```js
var options = {
indent_size: 2,
// ...
}
console.log(beautify.html('', 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!
```js
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](https://codepen.io/jasondavis/pen/JoxMXa).
## 🗨️ Final Words
If you are still having difficulty, we would love for you to post
a question to [the Simply Beautiful issues page](https://github.com/itw-creative-works/simply-beautiful/issues). 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](https://somiibo.com/): A Social Media Bot with an open-source module library.
[JekyllUp](https://jekyllup.com/): A website devoted to sharing the best Jekyll themes.
[Slapform](https://slapform.com/): A backend processor for your HTML forms on static sites.
[SoundGrail Music App](https://app.soundgrail.com/): A resource for producers, musicians, and DJs.
[Hammock Report](https://hammockreport.com/): An API for exploring and listing backyard products.Ask us to have your project listed! :)