Skip to content

Commit dc46de9

Browse files
committed
styles: generate from handlers/client/styles
1 parent 6a8f6d5 commit dc46de9

24 files changed

Lines changed: 374 additions & 340 deletions

File tree

client/head/index.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11

2-
require(`styles/${LANG}`);
3-
42
require('client/polyfill');
53

64
try {
Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if (env.DEV_TRACE) {
1818
require('clarify');
1919
}
2020

21-
module.exports = {
21+
var config = module.exports = {
2222
// production domain, for tutorial imports, descriptions, etc
2323
// for the places where in-dev we must use a real domain
2424
domain: {
@@ -157,17 +157,16 @@ module.exports = {
157157
courseRoot: path.join(process.cwd(), 'course'),
158158
tmpRoot: path.join(process.cwd(), 'tmp'),
159159
localesRoot: path.join(process.cwd(), 'locales'),
160-
// extra handlers from outside of the main repo
161-
extraHandlersRoot: path.join(process.cwd(), 'extra/handlers'),
162160
// js/css build versions
163161
manifestRoot: path.join(process.cwd(), 'manifest'),
164162
migrationsRoot: path.join(process.cwd(), 'migrations'),
165-
tutorialGithubBaseUrl: 'https://github.com/iliakan/javascript-tutorial/blob/' + lang
163+
tutorialGithubBaseUrl: 'https://github.com/iliakan/javascript-tutorial/blob/' + lang,
166164

165+
handlers: require('./handlers')
167166
};
168167

169168
// webpack config uses general config
170169
// we have a loop dep here
171-
module.exports.webpack = require('./webpack');
170+
config.webpack = require('./webpack')(config);
172171
require('./i18n');
173172

config/handlers.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
var path = require('path');
2+
var fs = require('fs');
3+
4+
var handlers = [
5+
'cls-handler', 'countryCode', 'mongooseHandler', 'requestId', 'requestLog', 'nocache',
6+
7+
// this middleware adds this.render method
8+
// it is *before errorHandler*, because errors need this.render
9+
'render',
10+
11+
// errors wrap everything
12+
'errorHandler',
13+
14+
// this logger only logs HTTP status and URL
15+
// before everything to make sure it log all
16+
'accessLogger',
17+
18+
// before anything that may deal with body
19+
// it parses JSON & URLENCODED FORMS,
20+
// it does not parse form/multipart
21+
'bodyParser',
22+
23+
// parse FORM/MULTIPART
24+
// (many tweaks possible, lets the middleware decide how to parse it)
25+
'multipartParser',
26+
27+
// right after parsing body, make sure we logged for development
28+
'verboseLogger',
29+
30+
'conditional',
31+
32+
'session',
33+
34+
'passportSession',
35+
36+
'passportRememberMe',
37+
38+
'lastActivity',
39+
40+
'csrfCheck',
41+
42+
'flash',
43+
44+
'paymentsMethods',
45+
46+
process.env.NODE_ENV == 'development' && 'markup',
47+
process.env.NODE_ENV == 'development' && 'dev',
48+
49+
'users', 'auth', 'ebook', 'donate', 'cache', 'search',
50+
'profile', 'jb', 'play', 'nodejsScreencast', 'webpackScreencast', 'about', 'imgur',
51+
'profileGuest', 'quiz', 'currencyRate', 'payments', 'downloadByLink', 'staticPage',
52+
'newsletter', 'mailer', 'courses'
53+
];
54+
55+
var extraHandlersRoot = path.join(process.cwd(), 'extra/handlers');
56+
57+
if (fs.existsSync(extraHandlersRoot)) {
58+
fs.readdirSync(extraHandlersRoot).forEach(function(extraHandler) {
59+
if (extraHandler[0] == '.') return;
60+
handlers.push(extraHandler);
61+
});
62+
}
63+
64+
// stick to bottom to detect any not-yet-processed /:slug
65+
handlers.push('tutorial');
66+
67+
// filter existing handlers
68+
handlers = handlers.filter(handler => {
69+
try {
70+
require.resolve(handler);
71+
return true;
72+
} catch(e) {
73+
return false;
74+
}
75+
});
76+
77+
module.exports = handlers;
File renamed without changes.

0 commit comments

Comments
 (0)