Skip to content

Node.js based forum software built for the modern web

using less for web installer

psychobunny005c95277b6e
diff --git a/install/web.js b/install/web.js
index 4b9b19ce03..39fd3420ce 100644
--- a/install/web.js
+++ b/install/web.js
@@ -2,8 +2,9 @@
var winston = require('winston'),
express = require('express'),
- nconf = require('nconf'),
+ fs = require('fs'),
path = require('path'),
+ less = require('less'),
app = express();
var web = {};
@@ -12,8 +13,10 @@ web.install = function(port) {
port = port || 8080;
winston.info('Launching web installer on port ', port);
- setupRoutes();
- launchExpress(port);
+ compileLess(function() {
+ setupRoutes();
+ launchExpress(port);
+ });
};
@@ -34,9 +37,21 @@ function setupRoutes() {
}
function install(req, res, next) {
- console.log('test');
res.render('install/index', {});
}
+function compileLess(callback) {
+ fs.readFile(path.join(__dirname, '../public/less/install.less'), function(err, style) {
+ less.render(style.toString(), function(err, css) {
+ if(err) {
+ return winston.error('Unable to compile LESS: ', err);
+ }
+
+ console.log(css);
+
+ fs.writeFile(path.join(__dirname, '../public/stylesheet.css'), css.css, callback);
+ });
+ });
+}
module.exports = web;
\ No newline at end of file
diff --git a/public/less/install.less b/public/less/install.less
new file mode 100644
index 0000000000..9385de3e86
--- /dev/null
+++ b/public/less/install.less
@@ -0,0 +1,20 @@
+.btn, .form-control, .navbar { border-radius: 0; }
+.container { font-size: 18px; }
+body, small, p, div { font-family: "Roboto", sans-serif; }
+.input-row {
+ margin-bottom: 20px;
+}
+.input-row.active .input-field {
+ border-right: 5px solid #BF3E11;
+ padding-right: 20px;
+}
+.input-row.active .help-text {
+ display: block;
+}
+
+.help-text {
+ line-height: 20px;
+ color: #888;
+ font-size: 85%;
+ display: none;
+}
\ No newline at end of file
diff --git a/src/views/install/index.tpl b/src/views/install/index.tpl
index b5d932efa2..29b45dd0de 100644
--- a/src/views/install/index.tpl
+++ b/src/views/install/index.tpl
@@ -8,6 +8,7 @@
<link rel="stylesheet" type="text/css" href="https://bootswatch.com/united/bootstrap.min.css">
<link href='http://fonts.googleapis.com/css?family=Roboto:400,300,500,700' rel='stylesheet' type='text/css'>
+ <link rel="stylesheet" type="text/css" href="stylesheet.css">
<!--[if lt IE 9]>
@@ -16,29 +17,6 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.js"></script>
<script>__lt_ie_9__ = 1;</script>
<![endif]-->
-
- <style type="text/css">
- .btn, .form-control, .navbar { border-radius: 0; }
- .container { font-size: 18px; }
- body, small, p, div { font-family: "Roboto", sans-serif; }
- .input-row {
- margin-bottom: 20px;
- }
- .input-row.active .input-field {
- border-right: 5px solid #BF3E11;
- padding-right: 20px;
- }
- .input-row.active .help-text {
- display: block;
- }
-
- .help-text {
- line-height: 20px;
- color: #888;
- font-size: 85%;
- display: none;
- }
- </style>
</head>
<body>