Beginnings of NanoGulp

This commit is contained in:
Tigercat2000
2015-12-24 11:26:37 -08:00
parent 7449cde946
commit 423ef23e18
30 changed files with 1212 additions and 59 deletions
+1
View File
@@ -208,6 +208,7 @@ proc/getFilesSlow(var/client/client, var/list/files, var/register_asset = TRUE)
var/list/common = list()
var/list/common_dirs = list(
"nano/assets/",
"nano/css/",
"nano/js/",
"nano/images/",
+1 -7
View File
@@ -106,13 +106,7 @@ nanoui is used to open and update nano browser uis
*/
/datum/nanoui/proc/add_common_assets()
add_script("libraries.min.js") // A JS file comprising of jQuery, doT.js and jQuery Timer libraries (compressed together)
add_script("nano_utility.js") // The NanoUtility JS, this is used to store utility functions.
add_script("nano_template.js") // The NanoTemplate JS, this is used to render templates.
add_script("nano_state_manager.js") // The NanoStateManager JS, it handles updates from the server and passes data to the current state
add_script("nano_state.js") // The NanoState JS, this is the base state which all states must inherit from
add_script("nano_state_default.js") // The NanoStateDefault JS, this is the "default" state (used by all UIs by default), which inherits from NanoState
add_script("nano_base_callbacks.js") // The NanoBaseCallbacks JS, this is used to set up (before and after update) callbacks which are common to all UIs
add_script("nano_base_helpers.js") // The NanoBaseHelpers JS, this is used to set up template helpers which are common to all UIs
add_script("nano.js") // A JS file of the NanoUI JavaScript concatenated into one file.
add_stylesheet("shared.css") // this CSS sheet is common to all UIs
add_stylesheet("icons.css") // this CSS sheet is common to all UIs
+2
View File
@@ -0,0 +1,2 @@
node_modules/
bower_components/
+48
View File
@@ -0,0 +1,48 @@
### Settings ###
util = require("gulp-util")
s =
min: util.env.min
# Project Paths
input =
scripts:
lib: "scripts/libraries"
main: "scripts/nano"
output =
dir: "assets"
scripts:
lib: "libraries.min.js"
main: "nano.js"
### Pacakages ###
del = require "del"
gulp = require "gulp"
merge = require "merge-stream"
### Plugins ###
g = require("gulp-load-plugins")({replaceString: /^gulp(-|\.)|-/g})
### Helpers ###
glob = (path) ->
"#{path}/*"
### Tasks ###
gulp.task "default", ["scripts"]
gulp.task "clean", ->
del glob output.dir
gulp.task "scripts", ["clean"], ->
lib = gulp.src glob input.scripts.lib
.pipe g.concat(output.scripts.lib)
.pipe g.uglify().on('error', util.log)
.pipe gulp.dest output.dir
main = gulp.src glob input.scripts.main
.pipe g.concat(output.scripts.main)
.pipe g.uglify().on('error', util.log)
.pipe gulp.dest output.dir
merge lib, main
+2
View File
@@ -0,0 +1,2 @@
require('coffee-script/register');
require('./Gulpfile.coffee');
+66
View File
@@ -0,0 +1,66 @@
# NanoUI
NanoUI is a user interface library, used for over 100 different interfaces, and rising.
It is
## Folder Rundown
### /assets
The assets folder is used by the Gulp compiling system, and stores the minified version of
the NanoUI JavaScript Library and prerequisites. Everything within this folder is sent to
the client as-is.
### /css
This folder is used for the CSS components of NanoUI. Everything within this folder is
sent to the client as-is.
### /images
This folder is used to store any image files. It is sent to the client as-is.
### /js
This folder is for JavaScript which cannot be compiled and put in the assets folder.
Currently, it is only used by the pre-minifed CodeMirror JavaScript. It is sent to the
client as-is.
### /layouts
This folder is used for the central "layout" template files, which is loaded before the
UI's actual template file. It is sent to the client as-is.
### /scripts
This folder is used for anything that will be compiled by the Gulp compilation system.
Currently, it is split into two folders. The file names must start with a number, as this
is how Gulp decides what order to put the concatenated and possibly minified files in.
Anything within this folder is not sent to the client directly.
#### /scripts/libraries
This folder is used to store the source code of the prerequisites of NanoUI. Currently,
it contains jQuery, jQuery UI, jQuery timers, and the doT template system.
#### /scripts/nano
This folder contains the primary JavaScript for NanoUI.
### /templates
This folder is used to store the .tmpl files which are later compiled by the NanoUtility
JavaScript, using a modified version of the doT template engine. It is sent to the client
as-is.
## Compiling
To compile any changes to the NanoUI JavaScript, you must first setup the building
environment.
### Prerequisites
You will first need to install the primary prerequisite of NanoUI, [Node.js](https://nodejs.org).
Node.js is used to obtain all of the remaining prerequisites to compile NanoUI. This is
done by running the following two commands.
- `npm install -g gulp`
- `npm install`
### Running Gulp
NanoUI is built using the `gulp` task automation system. This system uses the contents
of the `Gulpfile.js` and `Gulpfile.coffee` files to perform compilation tasks.
In order to build an un-minified version of NanoUI, you may simply run `gulp` in the
`nanoui` directory. However, this should only be used while testing, and you should run
the command `gulp --min` before commiting changes, in order to produce minified
JavaScript.
+5
View File
File diff suppressed because one or more lines are too long
+1071
View File
File diff suppressed because it is too large Load Diff
-1
View File
File diff suppressed because one or more lines are too long
-50
View File
File diff suppressed because one or more lines are too long
+15
View File
@@ -0,0 +1,15 @@
{
"name": "nanoui",
"private": true,
"dependencies": {
"del": "^2.2.0",
"gulp": "^3.9.0",
"gulp-concat": "^2.6.0",
"gulp-coffee": "^2.3.1",
"gulp-if": "^2.0.0",
"gulp-load-plugins": "^1.1.0",
"gulp-uglify": "^1.5.1",
"gulp-util": "^3.0.7",
"merge-stream": "^1.0.0"
}
}
@@ -8513,7 +8513,7 @@ var rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g;
var rvalidescape = /\\(?:["\\\/bfnrt]|u[\da-fA-F]{4})/g;
var rvalidtokens = /"[^"\\\r\n]*"|true|false|null|-?(?:\d+\.|)\d+(?:[eE][+-]?\d+|)/g;
jQuery.parseJSON: function( data ) {
jQuery.parseJSON = function( data ) {
// Attempt to parse using the native JSON parser first
if ( window.JSON && window.JSON.parse ) {
return window.JSON.parse( data );