Giter VIP home page Giter VIP logo

ether's Introduction

#Ether Ether is an development library and tool for JavaScript. ##What does it do? Ether fixes two big issues in developing large applications with JavaScript. Includes and the separation between release and debug code.


###Includes JavaScript isn't capable of including others files in runtime naturally. This leads to big files or has to dynamically load the code during runtime. While the first is good for release its bad for development contrary to the second which is good for development but most of the time bad for release.

Ether contains the namespace Ether.include under which you can find methods to include your code dynamically and in order. At runtime it act like one big file, with a bit performance loose, but you can separate each class.

Ether.include.JavaScript("scripts/awesome-three-d-engine.js");
Ether.include.JavaScript("scripts/jQuery.js");

$("p.neat").addClass("ohmy").show("slow");

This alone would be nothing worth to use Ether. But with the bundeled ether.exe you can easily create a release file in which every include becomes replaced by the file it should include. Ether.exe take care that no JavaScript File will be inserted more than once.

####Example:

File one.js:

Ether.include.JavaScript("two.js");
Ether.include.JavaScript("three.js");

File two.js:

var hello = "world";

File three.js:

alert("Hello "+hello+"!");

Start ether.exe with this:

ether.exe PATH/TO/THE/FILES one.js PATH/WHERE/TO/SAVE/THE/OUTPUT/hello_world.js

hello_world.js:

var hello = "world";
alert("Hello "+hello+"!");

In Ether.include are more functions to find that handle different file formats. This allows to seperate JSON-Files or HTML-Files from the javascript code.


###Separation between debug and release code

Everyone knows the little if(debug) that should prevent the code to do some things during release. Then why not delete it in release mode?

In Ether.debug.block are two handy functions and one nice constant. With Ether.debug.block.start() you can start a debug block and with Ether.debug.block.end() end one. While developing this will not have any effect but after run through the ether.exe everything including the line where the block started until the end call will be deleted and can't be found in the outputted file.

####Example

debug.js:

//Do some things and create variable
Ether.debug.block.start();
Console.log("Content of variable:"+variable);
Ether.debug.block.end();
//Do more with variable

Start ether.exe with this:

ether.exe PATH/TO/THE/FILES debug.js PATH/WHERE/TO/SAVE/THE/OUTPUT/release.js

release.js:

//Do some things and create variable
//Do more with variable

To explicite delete only one line like it would make sense in the above example you can use Ether.debug.block.line;Console.log("Content of variable:"+variable);. This will delete just this single line after ether.exe but won't do anything in development.


##More Features

  • Profiling in Ether.profiler (Thanks to victorporof for his basis to start from)
  • A log function with channel support in Ether.debug.console

##How do I use this awesome toolset?

Nothing easier than this. Just add to your HTML file the line <script src="PATH/TO/ether.js" data-main="RELATIVE/PATH/TO/SCRIPT.js"></script> and take care that it is the first <script>-Tag in the document.

After developing you produce the release version with the following command

ether.exe BASEPATH RELATIVE/PATH/TO/SCRIPT.js PATH/WHERE/THE/OUTPUTTED/FILE/SHOULD/BE.js

##Questions left?

Don't hesitate to send me an message. I will answer as fast as possible to help you.

Happy coding in JavaScript!

ether's People

Contributors

shanegrueling avatar

Stargazers

Oliver Meinusch 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.