Giter Club home page Giter Club logo

prettydiff's Introduction

Try it online at http://prettydiff.com/.

Pretty Diff logo Pretty Diff

Travis CI Build AppVeyor Build Gitter Twitter Tweets

Summary

Download with biddle

Language aware code comparison tool for several web based languages. It also beautifies, minifies, and a few other things.

Benefits - see overview page for more details

Executing Pretty Diff

Run with Node.js / CommonJS / RequireJS

A Node.js command line utility is provided by api/node-local.js. This file can execute in the following modes:

  • auto - Determine if the resource is text, a file, or a directory and process as such (except that directories are processed with the subdirectory option)
  • screen - code input is on the command line and output is to the command line
  • filescreen - code input is in a file and the output is to the command line
  • file - the input and the output reside in files
  • directory - everything in a directory is processed into a specified output directory except ".", "..", and subdirectories
  • subdirectory - process the entire directory tree

Execute in the context of a NodeJS application

Add this code to your application

var prettydiff = require("prettydiff"),
    args       = {
        source: "asdf",
        diff  : "asdd",
        lang  : "text"
    },
    output     = prettydiff(args);

Execute from the command line

Run in windows

node api/node-local.js source:"c:\myDirectory" readmethod:"subdirectory" diff:"c:\myOtherDirectory"

Run in Linux and OSX

node api/node-local.js source:"myDirectory" mode:"beautify" readmethod:"subdirectory" output:"path/to/outputDirectory"

To see a man page provide no arguments or these: help, man, manual

node api/node-local.js h
node api/node-local.js help
node api/node-local.js man
node api/node-local.js manual

To see only the version number supply only v or version as an argument:

node api/node-local.js v
node api/node-local.js version

To see a list of current settings on the console supply list as an argument:

node api/node-local.js l
node api/node-local.js list

Set configurations with a .prettydiffrc file.

Pretty Diff will first look for a .prettydiffrc file from the current directory in the command prompt. If the .prettydiffrc is not present in the current directory it will then look for it in the application's directory.

The .prettydiffrc first checks for JSON format. This allows a simple means of defining options in a file. It also allows a JavaScript application format so that options can be set conditionally.

Run in a web browser with api/dom.js

Please feel free to use index.xhtml file to supplement dom.js. Otherwise, dom.js requires supplemental assistance to map DOM nodes from an HTML source. dom.js is fault tolerant so nodes mapped to the supplied index.xhtml don't need to be supported from custom HTML.

To run Pretty Diff using dom.js include the following two script tags and bind the global.prettydiff.pd.recycle() function to the executing event. Please refer to index.xhtml for an HTML example and documentation.xhtml for option and execution information.

<script src="lib/global.js" type="application/javascript"></script>
<script src="lib/language.js" type="application/javascript"></script>
<script src="lib/options.js" type="application/javascript"></script>
<script src="lib/finalFile.js" type="application/javascript"></script>
<script src="lib/safeSort.js" type="application/javascript"></script>
<script src="ace/ace.js" type="application/javascript"></script> **(optional)**
<script src="api/dom.js" type="application/javascript"></script>
<script src="lib/csspretty.js" type="application/javascript"></script>
<script src="lib/csvpretty.js" type="application/javascript"></script>
<script src="lib/diffview.js" type="application/javascript"></script>
<script src="lib/jspretty.js" type="application/javascript"></script>
<script src="lib/markuppretty.js" type="application/javascript"></script>
<script src="prettydiff.js" type="application/javascript"></script>

Execute with vanilla JS

var global = {},
    args   = {
        source: "asdf",
        diff  : "asdd",
        lang  : "text"
    },
    output = prettydiff(args);

Run Pretty Diff in Atom code editor with the atom-beautify package.

Run the unit tests

cd prettydiff
node test/lint.js

License:

This project is mostly written by and managed by Austin Cheney and licensed under CC0 as of version 2.1.17. Please see license.txt for license langauge.

Acknowledgements

  • JS Pretty QA
  • JS Pretty widget
  • diffview.js QA

prettydiff's People

Contributors

gitter-badger avatar hdytsgt avatar mikaelbr avatar prettydiff avatar sasanj avatar

Watchers

 avatar  avatar  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.