Merge pull request #8158 from tigercat2000/nano_ui_tiger_edition

NanoUI Update/Refactor/Buildscript Rewrite
This commit is contained in:
Crazy Lemon
2017-10-25 16:14:15 -07:00
committed by GitHub
13 changed files with 218 additions and 146 deletions
-2
View File
@@ -111,8 +111,6 @@ nanoui is used to open and update nano browser uis
// CodeMirror
add_script("codemirror-compressed.js") // A custom minified JavaScript file of CodeMirror, with the following plugins: CSS Mode, NTSL Mode, CSS-hint addon, Search addon, Sublime Keymap.
add_stylesheet("codemirror.css") // A CSS sheet containing the basic stylings and formatting information for CodeMirror.
add_stylesheet("cm_lesser-dark.css") // A theme for CodeMirror to use, which closely resembles the rest of the NanoUI style.
/**
* Set the current status (also known as visibility) of this ui.
-108
View File
@@ -1,108 +0,0 @@
### Settings ###
util = require("gulp-util")
s =
min: util.env.min
# Project Paths
input =
fonts: "**/*.{eot,woff2}"
images: "images"
layouts: "layouts/"
scripts:
lib: "scripts/libraries"
main: "scripts/nano"
styles: "styles"
templates: "templates/"
output =
dir: "assets"
scripts:
lib: "libraries.min.js"
main: "nano.js"
css: "nanoui.css"
### Pacakages ###
bower = require "main-bower-files"
child_process = require "child_process"
del = require "del"
gulp = require "gulp"
merge = require "merge-stream"
### Plugins ###
g = require("gulp-load-plugins")({replaceString: /^gulp(-|\.)|-/g})
p =
autoprefixer: require "autoprefixer"
gradient: require "postcss-filter-gradient"
opacity: require "postcss-opacity"
rgba: require "postcss-color-rgba-fallback"
plsfilters: require "pleeease-filters"
### Helpers ###
glob = (path) ->
"#{path}/*"
### Tasks ###
gulp.task "default", ["fonts", "scripts", "styles"]
gulp.task "clean", ->
del glob output.dir
gulp.task "watch", ->
gulp.watch [glob input.images], ["reload"]
gulp.watch [glob input.layouts], ["reload"]
gulp.watch [glob input.scripts.lib], ["reload"]
gulp.watch [glob input.scripts.main], ["reload"]
gulp.watch [glob input.styles], ["reload"]
gulp.watch [glob input.templates], ["reload"]
gulp.task "reload", ["default"], ->
child_process.exec "reload.bat", (err, stdout, stderr) ->
return console.log err if err
gulp.task "fonts", ["clean"], ->
gulp.src bower input.fonts
.pipe gulp.dest output.dir
gulp.task "scripts", ["clean"], ->
lib = gulp.src glob input.scripts.lib
etc = gulp.src bower "**/*.js"
merged = merge lib, etc
.pipe g.order(["jquery.js",
"jquery*.js",
"*.js"])
.pipe g.concat(output.scripts.lib)
.pipe g.if(s.min, g.uglify().on('error', util.log))
.pipe gulp.dest output.dir
main = gulp.src glob input.scripts.main
.pipe g.order(["nano_utility.js",
"nano_state_manager.js"
"*.js"])
.pipe g.concat(output.scripts.main)
.pipe g.if(s.min, g.uglify().on('error', util.log))
.pipe gulp.dest output.dir
gulp.task "styles", ["clean"], ->
lib = gulp.src bower "**/*.css"
.pipe g.replace("../fonts/", "")
main = gulp.src glob input.styles
.pipe g.filter(["*.less", "!_*.less"])
.pipe g.less({paths: [input.images]})
.pipe g.postcss([
p.autoprefixer({browsers: ["last 2 versions", "ie >= 8"]}),
p.gradient,
p.opacity,
p.rgba({oldie: true}),
p.plsfilters({oldIE: true})
])
combined = merge lib, main
combined
.pipe g.if(s.min, g.cssnano({discardComments: {removeAll: true}}), g.csscomb())
.pipe g.concat(output.css)
.pipe gulp.dest output.dir
+168 -2
View File
@@ -1,2 +1,168 @@
require('coffee-script/register');
require('./Gulpfile.coffee');
/*
* NanoUI Buildscript v1.0
* JS Edition
*/
/* Configuration */
const input = {
cmirror: "codemirror",
fonts: "**/*.{eot,woff2}",
images: "images",
layouts: "layouts/",
scripts: {
lib: "scripts/libraries",
main: "scripts/nano"
},
styles: "styles",
templates: "templates/"
};
const output = {
_dir: "assets",
css: "nanoui.css",
scripts: {
"cmirror": "codemirror-compressed.js",
"lib": "libraries.min.js",
"main": "nano.js"
}
};
/* Dependencies */
var bower = require("main-bower-files");
var child_process = require("child_process");
var del = require("del");
var gulp = require("gulp");
var merge = require("merge-stream");
var util = require("gulp-util");
/* Gulp Plugins */
var $PLUG = require("gulp-load-plugins")({replaceString: /^gulp(-|\.)|-/g});
var postCSSFilters = {
autoprefixer: require("autoprefixer"),
gradient: require("postcss-filter-gradient"),
opacity: require("postcss-opacity"),
rgba: require("postcss-color-rgba-fallback"),
plsfilters: require("pleeease-filters")
};
/* Helpers */
const glob = function (path) {
return `${path}/*`;
};
var minify = util.env["min"];
/*------Task Section------*/
/* Task: Default
* Type: Default/Main
* Just runs the rest of the compilation tasks.
*/
gulp.task("default", ["fonts", "scripts", "styles"]);
/* Task: Clean
* Type: Dependency.
* Deletes everything inside the output directory to avoid conflicts when building new versions.
*/
gulp.task("clean", function () {
del(glob(output._dir));
});
/* Task: Watch
* Type: Main
* Run when someone uses `gulp watch`. Binds listeners to file events on any of the input files, recompiles on demand.
*/
gulp.task("watch", function () {
// Watch main scripts.
gulp.watch([glob(input.scripts.lib)], ["reload"]);
gulp.watch([glob(input.scripts.main)], ["reload"]);
// Watch images and CSS.
gulp.watch([glob(input.images)], ["reload"]);
gulp.watch([glob(input.styles)], ["reload"]);
// Watch for template files being changed.
gulp.watch([glob(input.layouts)], ["reload"]);
gulp.watch([glob(input.templates)], ["reload"]);
});
/* Task: Reload
* Type: Dependency
* Run whenever a file is changed. Recompiles and pushes all changes directly to the local BYOND client cache.
*/
gulp.task("reload", ["default"], function () {
child_process.exec("reload.bat", function (err, stdout, stderr) {
if(err)
return console.log(err);
});
});
/*---Buildtasks---*/
/* Task: Fonts
* Type: Build-dep
* Pipes fonts from bower into the nano cache directory.
*/
gulp.task("fonts", function () {
gulp.src(bower(input.fonts))
.pipe(gulp.dest(output._dir));
});
/* Task: Scripts
* Type: Build-dep
* Compiles all of the library and nano scripts, minifies them if necessary, and puts them in assets
*/
gulp.task("scripts", ["clean"], function () {
var lib = gulp.src(glob(input.scripts.lib));
var etc = gulp.src(bower("**/*.js"));
// Combine libraries and other js into one file
merge(lib, etc)
.pipe($PLUG.order(["jquery.js", "jquery*.js", "*.js"])) // Ensure jQuery is always loaded first
.pipe($PLUG.concat(output.scripts.lib)) // Concatenate all scripts into one file
.pipe($PLUG.if(minify, $PLUG.uglify().on("error", util.log))) // Minify if set in command line arguments
.pipe(gulp.dest(output._dir)); // Write the file
// Combine all of the nano scripts into one
gulp.src(glob(input.scripts.main))
.pipe($PLUG.order(["nano_utility.js", "nano_state_manager.js", "*.js"])) // Ensure Nano Util and state manager are always loaded first
.pipe($PLUG.concat(output.scripts.main)) // Concatenate all scripts into one file
.pipe($PLUG.if(minify, $PLUG.uglify().on("error", util.log))) // Minify if set in command line arguments
.pipe(gulp.dest(output._dir)); // Write the file
// Copy codemirror to the assets
gulp.src(glob(input.cmirror) + ".js")
.pipe($PLUG.concat(output.scripts.cmirror))
.pipe(gulp.dest(output._dir));
});
/* Task: Styles
* Type: Build-dep
* Concatenates all CSS in the project and compiles our Nano LESS templates
*/
gulp.task("styles", ["clean"], function () {
// Get all of the random bower CSS files into `lib`
var lib = gulp.src(bower("**/*.css"))
.pipe($PLUG.replace("../fonts/", ""));
// Gather all of our actual nanoUI styles, compile the LESS, apply postCSS filters
var main = gulp.src(glob(input.styles))
.pipe($PLUG.filter(["*.less", "!_*.less"]))
.pipe($PLUG.less({paths: [input.images]}))
.pipe($PLUG.postcss([
postCSSFilters.autoprefixer({browsers: ["last 2 versions", "ie >= 8"]}),
postCSSFilters.gradient,
postCSSFilters.opacity,
postCSSFilters.rgba({oldie: true}),
postCSSFilters.plsfilters({oldIE: true})
]));
var codemirror = gulp.src(glob(input.cmirror) + ".css");
// Merge the lib and main nano styles into one file
merge(codemirror, lib, main)
.pipe($PLUG.if(minify, $PLUG.cssnano({discardComments: {removeAll: true}}), $PLUG.csscomb())) // Minify if necessary
.pipe($PLUG.concat(output.css)) // Concatenate all CSS into one file
.pipe(gulp.dest(output._dir)); // Write the file
});
-2
View File
@@ -23,8 +23,6 @@ This section is for listing the contributors to NanoUI.
- NanoUI's JavaScript controlling the "fancy" borderless window mode.
- The NanoTrasen.svg logo (Licensed under CC 3.0 BY-SA).
- The Gulp buildscript concept, as well as a large amount of the actual
Gulpfile.coffee.
- The packages in bower.json and packages.json files were hand-picked by Neersighted
for usage in compiling NanoUI.
- A considerable amount of this README is adapated from Neersighted's documentation.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
+1 -5
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -3,7 +3,7 @@
"license": "AGPLv3",
"private": true,
"dependencies": {
"font-awesome": "~4.5.0",
"font-awesome": "~4.7.0",
"jsurl": "*"
},
"overrides": {
+20 -22
View File
@@ -2,28 +2,26 @@
"name": "nanoui",
"private": true,
"dependencies": {
"autoprefixer": "^6.2.2",
"del": "^2.2.0",
"font-awesome": "^4.5.0",
"gulp": "^3.9.0",
"gulp-coffee": "^2.3.1",
"gulp-concat": "^2.6.0",
"gulp-csscomb": "^3.0.6",
"gulp-cssnano": "^2.0.0",
"gulp-filter": "^3.0.1",
"gulp-if": "^2.0.0",
"gulp-less": "^3.0.5",
"gulp-load-plugins": "^1.1.0",
"gulp-order": "^1.1.1",
"gulp-postcss": "^6.0.1",
"gulp-replace": "^0.5.4",
"gulp-uglify": "^1.5.1",
"gulp-util": "^3.0.7",
"main-bower-files": "^2.9.0",
"merge-stream": "^1.0.0",
"pleeease-filters": "^2.0.0",
"autoprefixer": "7.1.4",
"del": "3.0.0",
"gulp": "3.9.1",
"gulp-concat": "2.6.1",
"gulp-csscomb": "3.0.8",
"gulp-cssnano": "2.1.2",
"gulp-filter": "5.0.1",
"gulp-if": "2.0.2",
"gulp-less": "3.3.2",
"gulp-load-plugins": "1.5.0",
"gulp-order": "1.1.1",
"gulp-postcss": "7.0.0",
"gulp-replace": "0.6.1",
"gulp-uglify": "3.0.0",
"gulp-util": "3.0.8",
"main-bower-files": "2.13.1",
"merge-stream": "1.0.1",
"pleeease-filters": "4.0.0",
"postcss-color-rgba-fallback": "git+https://github.com/postcss/postcss-color-rgba-fallback",
"postcss-filter-gradient": "^0.2.1",
"postcss-opacity": "^3.0.0"
"postcss-filter-gradient": "1.0.0",
"postcss-opacity": "5.0.0"
}
}
+1 -1
View File
@@ -101,7 +101,7 @@ Used In File(s): /code/game/machinery/alarm.dm
</div>
<div class="line">
<div class="statusLabel">Thermostat:</div>
{{:helper.link(data.target_temp+" C", 'arrows-v', {'temperature': 1})}}
{{:helper.link(data.target_temp+" C", 'thermometer', {'temperature': 1})}}
</div>
</div>
{{/if}}