Javascript framework for building modern web applications
Xone provides a lightweight full stack environment to develop beautiful applications for every use and enables the optimal integration of an universal codebase into a wide range of systems (e.g. mobile devices, tablets, desktops, browser environments).
Notice: Actually this is an alpha state of this repository. Some breaking changes could possibly be introduced in upcoming versions. Do not use for production until this message has been removed.
Overview
- Manage and execute production, development and test environments seamlessly at the same time
- Integrates fast development in a web browser environment (develop > build > deploy)
- Provides HTML-CSS-friendly templating system with which designers (non-coders) can also work
- Xone libraries completely compiles with your codebase (only the used code remains in a single javascript binary file)
- Therefore you will get the most lightweight footprint possible
- Provides advanced MVC architecture for your app (e.g. persistent models, routes, request controller, event controller, handlers, views, mapper)
- Incredibly accellerate DOM changes through a performance optimized render engine
- Simple, fast and natural usage out of the box
- Targeting products: hybrid apps, progressive web apps, cordova/phonegap/ionic, single-page web apps, browser apps
Xone basically is available in 3 different versions:
- Xone Project (Development Environment)
- initial project created by
xone create
- Provides you a scalable development stack for modern web-based applications on top of Node.js
- Is intended for a compilation/build
- Xone Extern Bundle (Standalone)
- xone.bundle.js
- Alternatively use this bundle to add Xone as a dependency to an already existing build/compiler system (compatible with Closure Compiler "Advanced Mode")
- Is intended for a compilation/build
- Xone Extern Library (Standalone)
- xone.lib.jsā >ā xone.lib.min.js
- Skips the build part completely and make Xone using like a jQuery library in your web-based project
- Is not intended for a compilation
Xone Comparison: 1. Project, 2. Bundle, 3. Library
Features by default | Xone Project (Environment) | Xone Bundle (Standalone) | Xone Library (Standalone) |
---|
Final project filesize | smallest | small | normal |
Core Library |  |  |  |
MVC Framework |  |  |  |
Render Engine |  |  |  |
Unit Tests |  | - | - |
Debugging Tools |  |  | - |
Environments |  | - | - |
Global App Configuration |  |  | - |
Build/Compile Project |  |  | - |
Manage Platforms |  | - | - |
Dynamic Templates (HTML > JSON) |  | - | - |
Dependency Management |  | - | - |
Initial Codebase |  | - | - |
CLI Tools |  | - | - |
Support Closure Compiler Advanced Mode |  |  | - |
Dead Code Removal |  |  | - |
Not strictly bound by Conventions | - |  |  |
Does not require Node.js | - |  |  |
Use as a Standalone Library (like jQuery/Underscore) | - |  |  |
Use as a Framework (like Bootstrap/Angular) |  |  | - |
Use as a Dev Environment (like Sencha/Meteor) |  | - | - |
Installation (Xone Project)
> npm install -g xone
Note: To make the Xone CLI globally available, you have to install Xone as a global npm module (also in addition to any local installation if you want to keep simple as most as possible). You can also use a local custom versions of Xone as well as using the CLI without any global installations (read further).
Note: Xone Project binaries typically has to be installed via "xone create" or "xone install" and comes with its own pre-defined folder structure (followed by some conventions). You can pick one of the two stand-alone versions optionally to skip as many conventions as possible (e.g. Xone acts like an extern Javascript Plugin).
Windows
Alternatively in the root of your project you can use the local CLI shortcut app instead for xone, e.g.:
my_project> app build
Note: The options create and install both are not available over the shortcut app.
MacOS/Linux
On a linux machine you may use:
sudo npm install -g xone
If the global "xone" identifier is not registered properly try one of these lines:
hash xone
hash -r
Alternatively you can use the local CLI fallback like:
bash xone build
Create New Xone Project
Create a new project inside the directory workspace/my_project:
workspace> xone create my_project
Works, but it is generally not recommended to use whitespaces in a project folder name:
workspace> xone create "my project"
Read further
Update existing Xone project
To update Xone of an already existing project you basically need 2 steps:
- Fetch and install latest version via npm:
> npm install -g xone
- Install update to a Xone project (automatically fetches sources from npm_modules)
workspace/my_project> xone install
Note: This will not overwrite any of your project files! Only projects xone library files located in app/lib/xone/ are updated.
Read further
Build Xone project
Un-compiled sources located in: workspace/my_project/app/*
my_project> xone build
Production build located in: workspace/my_project/bin/www/*
Note: We recommended to use production builds for any external/public release and use the sources only for developing, testing and may some other internal purposes. To skip the build integration of Xone, you have to use the standalone version instead.
Run Xone project (Local Webserver)
my_project> xone server
Open your preferred webrowser and goto 'http://localhost/app/' or 'http://localhost/bin/www/'
Optionally you can pass custom host and port:
my_project> xone server localhost 8080
Open your preferred webrowser and goto 'http://localhost:8080'
Run Xone project (Local Filesystem)
Open app/index.html from sources or bin/www/index.html from production build in your preferred browser.
Deploy Xone project (Cordova, Web, etc.)
Use production builds located in workspace/my_project/bin/* to move forward into your Cordova-based projects or upload to a webserver.
Manage platforms
Xone provides custom platform injections to perform platform specific production builds. Therefore all those builds only includes necessary code and dependencies for their related platform.
Show currently defined platforms:
my_project> xone platform
Perform platform specific compilation:
my_project> xone compile android
Compiled files remains in: workspace/my_project/app/*
Perform platform specific builds:
my_project> xone build android
Build destination: workspace/my_project/bin/android/*
Add custom platforms
You can add unlimited custom platforms, e.g. create a platform 'webapp':
my_project> xone platform add webapp
my_project> xone build webapp
Build destination: workspace/my_project/bin/webapp/*
Build Xone Standalone
my_project> xone build bundle
Build destination: workspace/my_project/app/lib/xone/dist/xone.bundle.js
my_project> xone build lib
Build destination: workspace/my_project/app/lib/xone/dist/xone.lib.js
my_project> xone build lib min ./app/js/
Build destination: workspace/my_project/app/js/xone.lib.min.js
Note: The order of passed parameters cannot be changed actually.
Configure Build Tool
Xone build uses the Google Closure Compiler. All Xone libraries also supports compilation in "Advanced Mode". The build properties can be configured in xone.json
. The Closure Compiler also provides a simple dependency management system (provide/require) you should make use of to improve dead code removal.
Note: Actually Xone supports 2 different versions of closure compiler: 1. requires Java, 2. requires Javascript (Node). It is recommended to have a Java (JRE) properly installed on your machine to unlock some benefits of the Closure Compiler Java version. To change the type of the compiler you need to change the value of the field closure_compiler_lib_type
from "js"
into "jar"
in xone.json
accordingly.
Note: If you have less experience with the Closure Compiler you can optionally set the compilation level to "simple" on the field closure_compiler_level
within the xone config file.
Comparison: Closure Compiler (Java) VS. Closure Compiler (Javascript)
Features by default | Closure Compiler (Java) | Closure Compiler (Javascript) |
---|
Dependency Management |  |  |
Auto Sort Dependencies |  | - |
"Strict" Dependencies (Entry Point) |  | - |
"Pretty Print" Compilation |  | - |
Build Performance | Normal | Slow |
Compression Ratio | Best | Good |
Memory Consumption | Normal | Extreme |
Generating Docs (JSDoc)
my_project> xone docs
Docs will be generated in 'docs/api/'.
Using Xone Standalone Library
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
</head>
<body>
<script src="js/xone.lib.min.js"></script>
<script src="js/app.js"></script>
</body>
</html>
Xone Render Engine
The render engine provides an optional "fast mode" to get the most out of performance. All internal processes of Xone takes advantage when "fast mode" is enabled (e.g. render templates, animate elements, toggle views). When it runs in "fast mode" the render engine has a very closed infrastructure you should keep notice:
- CSS Styles
- CSS Classes
- Change classes
- Get classes
- HTML Content
- Change contents
- Get contents
Note: When "fast mode" is enabled it should not be mixed by any other external manipulations of the same category listed above. We recommended to disable the "fast mode" when style issues occurs by any direct style manipulations (e.g. when using an extern library).
Note: The "fast mode" is enabled by default in a Xone Project (may change in future) and is disabled by default in the Xone Extern Library.
Performance Comparison: Native VS. jQuery VS. Xone
Restrictions (when "fast mode" is enabled)
The problem:
var display;
display = document.getElementById('my_div').style.display;
console.log(display);
CORE.setStyle('my_div', 'display', 'none');
display = CORE.getStyle('my_div', 'display');
console.log(display);
display = document.getElementById('my_div').style.display;
console.log(display);
Instead do this:
var display;
CORE.setStyle('my_div', 'display', 'none');
CORE.paint(function(){
display = document.getElementById('my_div').style.display;
console.log(display);
});
Development Environments
Default environments are:
- production (live build)
- development (local)
- test (local)
- benchmark (local)
Change environment in app/manifest.js
:
"env": "development",
"platform": "www"
Or just adding parameters to the URL:
http://localhost:9000/?env=test&platform=android&debug=true
Note: You are also able to override any CONFIG
attribute by passing URL parameters respectively.
Custom Environments
Show currently defined environments:
my_project> xone env
Add custom environments:
my_project> xone env add offline
Build destination: workspace/my_project/app/config/offline.js
TODO
Features
- Manage Development Environments:
- production, development, test, benchmark
- Manage Process Environments (Rack):
- webapp, cordova, native, local, browser
- Manage Platform Environments:
- Android, iOS, Windows, Webkit, Mozilla, MSIE
- Model-View-Controller
- Supports persistent model management
- Full MVC-managed environment:
- Routes
- Events
- Handlers
- Controller
- Interfaces
- Adapter
- Models
- Mapper
- Views
- Payloads
- Threads / Worker
- Stubs / Mocks
- Translations
- Javascript Core Library
- Codebase Dependency Management
- Supports DOM pattern in JSON format
- Template System
- Static Content
- Dynamic Content
- Partials
- Locales
- Build System
- Template Compiler
- Local Webserver
- Layout Manager
- Multi-Platform-Injections
- Event Delegation
- NoSQL Persistent Storage
- GZIP Storage Data Compression
- FlexiCache (auto-scale, auto-clean)
- Multi Language Support
- Unit Test Integration
- Versioning & Migrations
- Dev Task Hooks (Compile, Build, Deploy, Process)
- Xone Library Hooks (MVC, Storage, Handlers, Events)
- Debug Mode
- Debugger Tools
- Performance Tools
- Analytics/Statistic Tools
- Benchmark Integration
- Closure Compiler Integration ("Advanced Mode")
- Less CSS Integration
- CSS Compressor Integration
- JSDoc Integration
- Provides the most possible performance while ensuring maximum crossplatform support
- Compatible with almost each library out there (also can be mixed with similar technologies like: Angular or React)