From 5dcfe0e1ca457062a93eb42b4fb6e2c980b2b8da Mon Sep 17 00:00:00 2001 From: David Date: Mon, 17 Apr 2017 14:23:50 -0400 Subject: [PATCH] upgrade jade to pug --- app.js | 7 +++--- package.json | 2 +- routes/site_router.js | 2 +- views/{login.jade => login.pug} | 23 ++++--------------- views/{marbles.jade => marbles.pug} | 22 +++++++++--------- views/{panel_audit.jade => panel_audit.pug} | 0 views/{panel_create.jade => panel_create.pug} | 2 +- views/{panel_home.jade => panel_home.pug} | 0 ...panel_settings.jade => panel_settings.pug} | 0 .../{panel_startup.jade => panel_startup.pug} | 0 ...panel_tx_story.jade => panel_tx_story.pug} | 0 .../{blockchain.jade => blockchain.pug} | 0 .../{color_options.jade => color_options.pug} | 0 views/template/{error.jade => error.pug} | 8 +++---- views/template/{layout.jade => layout.pug} | 11 ++------- views/template/{nav.jade => nav.pug} | 0 16 files changed, 28 insertions(+), 49 deletions(-) rename views/{login.jade => login.pug} (76%) rename views/{marbles.jade => marbles.pug} (65%) rename views/{panel_audit.jade => panel_audit.pug} (100%) rename views/{panel_create.jade => panel_create.pug} (95%) rename views/{panel_home.jade => panel_home.pug} (100%) rename views/{panel_settings.jade => panel_settings.pug} (100%) rename views/{panel_startup.jade => panel_startup.pug} (100%) rename views/{panel_tx_story.jade => panel_tx_story.pug} (100%) rename views/template/{blockchain.jade => blockchain.pug} (100%) rename views/template/{color_options.jade => color_options.pug} (100%) rename views/template/{error.jade => error.pug} (59%) rename views/template/{layout.jade => layout.pug} (81%) rename views/template/{nav.jade => nav.pug} (100%) diff --git a/app.js b/app.js index e05c36204..26603c278 100644 --- a/app.js +++ b/app.js @@ -48,8 +48,7 @@ if (process.env.VCAP_APPLICATION) { // --- Pathing and Module Setup --- // app.set('views', path.join(__dirname, 'views')); -app.set('view engine', 'jade'); -app.engine('.html', require('jade').__express); +app.set('view engine', 'pug'); app.use(compression()); app.use(cookieParser()); app.use(serve_static(path.join(__dirname, 'public'))); @@ -60,8 +59,8 @@ app.use(cors()); //--------------------- // Cache Busting Hash //--------------------- -process.env.cachebust_js = Date.now(); //i'm just making 1 hash against all js for easier jade implementation -process.env.cachebust_css = Date.now(); //i'm just making 1 hash against all css for easier jade implementation +process.env.cachebust_js = Date.now(); //i'm just making 1 hash against all js for easier pug implementation +process.env.cachebust_css = Date.now(); //i'm just making 1 hash against all css for easier pug implementation logger.debug('cache busting hash js', process.env.cachebust_js, 'css', process.env.cachebust_css); // ============================================================================================================================ diff --git a/package.json b/package.json index 18c1df1ac..c053a8c2c 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "express-session": "1.14.*", "fabric-ca-client": "1.0.0-alpha.0", "fabric-client": "1.0.0-alpha", - "jade": "1.11.*", + "pug": "2.0.0-beta11", "serve-static": "1.11.*", "winston": "2.2.*", "ws": "1.1.*" diff --git a/routes/site_router.js b/routes/site_router.js index 81356a6d9..879feb208 100644 --- a/routes/site_router.js +++ b/routes/site_router.js @@ -9,7 +9,7 @@ var express = require('express'); var router = express.Router(); -//anything in here gets passed to JADE template engine +//anything in here gets passed to Pug template engine function build_bag(req) { return { e: process.error, //send any setup errors diff --git a/views/login.jade b/views/login.pug similarity index 76% rename from views/login.jade rename to views/login.pug index f933b8635..ac8c80370 100644 --- a/views/login.jade +++ b/views/login.pug @@ -1,21 +1,21 @@ -extends ./template/layout.jade +extends ./template/layout.pug -// --------------- Header -------------- // block custom_header + // --------------- Header -------------- // script(type='text/javascript'). $(document).ready(function(){ }); -// --------------- Navigation Bar -------------- // block navpanel - include ./template/nav.jade + // --------------- Navigation Bar -------------- // + include ./template/nav.pug -// --------------- Main Stuff -------------- // block content + // --------------- Main Stuff -------------- // #notificationWrap #contentPanel @@ -74,16 +74,3 @@ block content hr input(type="text" placeholder="username" value="admin" name="username") button(type="submit") Login - - - //#test(style="position: relative;") - #marbleWrap - div.ball#proposeMarbleStable.hideBorders - div.ball#marbleBorderTop - div.ball#marbleBorderBottom - div.ball#marbleBorderLeft - div.ball#marbleBorderRight - #dummy - -//block footer - include ./template/blockchain.jade \ No newline at end of file diff --git a/views/marbles.jade b/views/marbles.pug similarity index 65% rename from views/marbles.jade rename to views/marbles.pug index c833d64b2..088fd0925 100644 --- a/views/marbles.jade +++ b/views/marbles.pug @@ -1,8 +1,8 @@ -extends ./template/layout.jade +extends ./template/layout.pug -// --------------- Header -------------- // block custom_header + // --------------- Header -------------- // script(src='/js/ui_events.js?v=#{bag.jshash}') script(src='/js/websocket.js?v=#{bag.jshash}') script(src='/js/startup.js?v=#{bag.jshash}') @@ -13,13 +13,13 @@ block custom_header }); -// --------------- Navigation Bar -------------- // block navpanel - include ./template/nav.jade + // --------------- Navigation Bar -------------- // + include ./template/nav.pug -// --------------- Main Stuff -------------- // block content + // --------------- Main Stuff -------------- // #notificationsWrap #noticeScrollWrap #emptyNotifications.hint No Notifications @@ -32,19 +32,19 @@ block content #contentPanel // --------------- Home Panel - include ./panel_home.jade + include ./panel_home.pug // --------------- Create Panel - include ./panel_create.jade + include ./panel_create.pug // --------------- Start Up Walk Through Panel - include ./panel_startup.jade + include ./panel_startup.pug // --------------- Walk Transaction Panel - include ./panel_tx_story.jade + include ./panel_tx_story.pug // --------------- Settings Panel - include ./panel_settings.jade + include ./panel_settings.pug block footer - include ./template/blockchain.jade \ No newline at end of file + include ./template/blockchain.pug \ No newline at end of file diff --git a/views/panel_audit.jade b/views/panel_audit.pug similarity index 100% rename from views/panel_audit.jade rename to views/panel_audit.pug diff --git a/views/panel_create.jade b/views/panel_create.pug similarity index 95% rename from views/panel_create.jade rename to views/panel_create.pug index 96e81e344..747f66527 100644 --- a/views/panel_create.jade +++ b/views/panel_create.pug @@ -15,7 +15,7 @@ //br legend - include ./template/color_options.jade + include ./template/color_options.pug br legend diff --git a/views/panel_home.jade b/views/panel_home.pug similarity index 100% rename from views/panel_home.jade rename to views/panel_home.pug diff --git a/views/panel_settings.jade b/views/panel_settings.pug similarity index 100% rename from views/panel_settings.jade rename to views/panel_settings.pug diff --git a/views/panel_startup.jade b/views/panel_startup.pug similarity index 100% rename from views/panel_startup.jade rename to views/panel_startup.pug diff --git a/views/panel_tx_story.jade b/views/panel_tx_story.pug similarity index 100% rename from views/panel_tx_story.jade rename to views/panel_tx_story.pug diff --git a/views/template/blockchain.jade b/views/template/blockchain.pug similarity index 100% rename from views/template/blockchain.jade rename to views/template/blockchain.pug diff --git a/views/template/color_options.jade b/views/template/color_options.pug similarity index 100% rename from views/template/color_options.jade rename to views/template/color_options.pug diff --git a/views/template/error.jade b/views/template/error.pug similarity index 59% rename from views/template/error.jade rename to views/template/error.pug index d584e78db..f326da83b 100644 --- a/views/template/error.jade +++ b/views/template/error.pug @@ -1,21 +1,21 @@ -extends ./layout.jade +extends ./layout.pug -// --------------- Header -------------- // block custom_header + // --------------- Header -------------- // script(type='text/javascript'). $(document).ready(function(){ }); -// --------------- Navigation Bar -------------- // block navpanel + // --------------- Navigation Bar -------------- // #logo Marbles P? -// --------------- Main Stuff -------------- // block content + // --------------- Main Stuff -------------- // #contentPanel h1 Error: #{bag.error.status} diff --git a/views/template/layout.jade b/views/template/layout.pug similarity index 81% rename from views/template/layout.jade rename to views/template/layout.pug index 5e8f465bb..9f7d4a594 100644 --- a/views/template/layout.jade +++ b/views/template/layout.pug @@ -1,10 +1,3 @@ --////////////////////////////////////////////////// Functions ////////////////////////////////////////////////// --//Print Object Out Formatted -mixin debug(variable) - br - br - pre #{JSON.stringify(variable, null, "\t")} - -////////////////////////////////////////////////// HTML ////////////////////////////////////////////////// -//Begin HTML doctype html @@ -27,7 +20,7 @@ html script(src='/js/blockchain.js?v=#{bag.jshash}') script(src='/js/ui_building.js?v=#{bag.jshash}') script(type='text/javascript'). - var bag = !{JSON.stringify(bag)}; //throw jade json over to JS + var bag = !{JSON.stringify(bag)}; //throw json over to JS console.log('bag', bag); $(document).ready(function(){ $(".colorInput").click(function(){ //do not remove! no idea why but this helps safari open the color picker @@ -53,4 +46,4 @@ html block footer #leftEverything - include ../panel_audit.jade \ No newline at end of file + include ../panel_audit.pug \ No newline at end of file diff --git a/views/template/nav.jade b/views/template/nav.pug similarity index 100% rename from views/template/nav.jade rename to views/template/nav.pug