Giter Club home page Giter Club logo

pug-beautify's Introduction

Pug(former jade) beautify

This tiny program format a pug(former jade) template file. For reusability, it's made as a module suggested by @Glavin001. Please refer this issue.

Installation

npm install pug-beautify

Test

npm run test

Options

  • fill_tab - boolean, fill whether tab or space, default true.
  • omit_div - boolean, whether omit 'div' tag, default false.
  • tab_size - number, when 'fill_tab' is false, fill 'tab_size' spaces, default 4.
  • separator_space - boolean, When 'separator_space' is true, the attribute separator is comma, default true.
  • omit_empty_lines - When 'separator_space' is false, delete line blank, default true.

How to use

var output = pugBeautify(code);
var output = pugBeautify(code,{
    fill_tab:true,
    omit_div:false,
    tab_size:4,
    separator_space:true,
});

Example code

var fs = require('fs');
var pugBeautify = require('pug-beautify');
var code = fs.readFileSync('sample.jade','utf8');
var option = {
    fill_tab: true,
    omit_div: false,
    tab_size: 4,
    separator_space: true
};
try {
    var output = pugBeautify(code,option);
}catch(error){
    // Error occurred
}

Todo

pug-beautify's People

Contributors

maranimatias avatar vingorius avatar yukulele avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.