WIP: migrate from jade to pug

This commit is contained in:
Shane Kilkelly
2017-01-20 12:03:02 +00:00
parent 3413687833
commit 57cd54bf55
67 changed files with 1469 additions and 1749 deletions

View File

@@ -222,11 +222,11 @@ module.exports = (grunt) ->
sed:
version:
path: "app/views/sentry.jade"
path: "app/views/sentry.pug"
pattern: '@@COMMIT@@',
replacement: '<%= commit %>',
release:
path: "app/views/sentry.jade"
path: "app/views/sentry.pug"
pattern: "@@RELEASE@@"
replacement: process.env.BUILD_NUMBER || "(unknown build)"
@@ -389,5 +389,5 @@ module.exports = (grunt) ->
grunt.registerTask 'default', 'run'
grunt.registerTask 'version', "Write the version number into sentry.jade", ['git-rev-parse', 'sed']
grunt.registerTask 'version', "Write the version number into sentry.pug", ['git-rev-parse', 'sed']

View File

@@ -7,7 +7,7 @@ fs = require "fs"
ErrorController = require "../Errors/ErrorController"
AuthenticationController = require('../Authentication/AuthenticationController')
homepageExists = fs.existsSync Path.resolve(__dirname + "/../../../views/external/home.jade")
homepageExists = fs.existsSync Path.resolve(__dirname + "/../../../views/external/home.pug")
module.exports = HomeController =
index : (req,res)->
@@ -28,10 +28,10 @@ module.exports = HomeController =
externalPage: (page, title) ->
return (req, res, next = (error) ->) ->
path = Path.resolve(__dirname + "/../../../views/external/#{page}.jade")
path = Path.resolve(__dirname + "/../../../views/external/#{page}.pug")
fs.exists path, (exists) -> # No error in this callback - old method in Node.js!
if exists
res.render "external/#{page}.jade",
res.render "external/#{page}.pug",
title: title
else
ErrorController.notFound(req, res, next)

View File

@@ -1,6 +1,6 @@
fs = require "fs"
Path = require "path"
jade = require "jade"
pug = require "pug"
async = require "async"
MODULE_BASE_PATH = Path.resolve(__dirname + "/../../../modules")
@@ -29,7 +29,7 @@ module.exports = Modules =
for module in @modules
for view, partial of module.viewIncludes or {}
@viewIncludes[view] ||= []
@viewIncludes[view].push jade.compile(fs.readFileSync(Path.join(MODULE_BASE_PATH, module.name, "app/views", partial + ".jade")), doctype: "html")
@viewIncludes[view].push pug.compile(fs.readFileSync(Path.join(MODULE_BASE_PATH, module.name, "app/views", partial + ".pug")), doctype: "html")
moduleIncludes: (view, locals) ->
compiledPartials = Modules.viewIncludes[view] or []

View File

@@ -62,7 +62,7 @@ if Settings.behindProxy
webRouter.use express.static(__dirname + '/../../../public', {maxAge: staticCacheAge })
app.set 'views', __dirname + '/../../views'
app.set 'view engine', 'jade'
app.set 'view engine', 'pug'
Modules.loadViewIncludes app

File diff suppressed because it is too large Load Diff

View File

@@ -64,7 +64,8 @@
"underscore": "1.6.0",
"v8-profiler": "^5.2.3",
"xml2js": "0.2.0",
"passport-saml": "^0.15.0"
"passport-saml": "^0.15.0",
"pug": "^2.0.0-beta6"
},
"devDependencies": {
"bunyan": "0.22.1",

View File

@@ -13,7 +13,7 @@ define [
EditSession = ace.require('ace/edit_session').EditSession
ModeList = ace.require('ace/ext/modelist')
# set the path for ace workers if using a CDN (from editor.jade)
# set the path for ace workers if using a CDN (from editor.pug)
if window.aceWorkerPath != ""
syntaxValidationEnabled = true
ace.config.set('workerPath', "#{window.aceWorkerPath}")