forked from Virginia-iGEM/igem-wikibrick
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.js
209 lines (191 loc) · 8.01 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
const path = require('path');
var argv = require('yargs')
.boolean(['--dev', '-d'])
.boolean(['--live', '-l'])
.argv;
module.exports = function(root) {
var environments = {
dev: {
banner: false,
minify: false,
relative2absolute: false,
serve: true,
debug: true,
browserify: false,
noconcat: false,
importantify: false
},
live: {
banner: true,
minify: false,
relative2absolute: true,
serve: false,
debug: false,
browserify: false,
noconcat: false,
importantify: false
}
};
var shortflag;
if (argv.l) {
shortflag = 'live';
}
else if (argv.d) {
shortflag = 'dev';
}
var userenv = argv.env || shortflag || 'dev'; // Try env variable, else fallback on shortflag, else assume we're in dev
var environment = Object.assign(environments[userenv], {name: userenv});
var app = path.join(root, '/app/');
var build = path.join(root, '/build/');
// Teaminfo. Duh.
const teaminfo = {
year: 2018,
teamName: 'Virginia'
};
const imagetypes = '{png,jpg,gif,svg}';
const fonttypes = '{ttf,otf,woff}';
// Listed file sources for all tasks. Note use of glob patterns and wildcarding.
// Used by any build tasks.
var buildsrc = {
htmlpages: [path.join(app, '**/*.html'), path.join('!', app, '{templates,partials,content}/**/*.html')],
hbspages: [path.join(app, '**/*.hbs'), path.join('!', app, '{templates,partials,content}/**/*.hbs')],
htmlcontent: path.join(app, 'content/**/*.html'),
markdowncontent: path.join(app, 'content/**/*.md'),
docxcontent: path.join(app, 'content/**/*.docx'),
//drivecontent: TODO,
partials: [path.join(app, 'partials/')],
templates: path.join(app, 'templates/**/*.html'),
css: path.join(app, 'styles/**/*.css'),
scss: path.join(app, 'styles/**/*.scss'),
js: path.join(app, 'scripts/**/*.js'),
images: path.join(app, `images/**/*.${imagetypes}`),
fonts: path.join(app, `fonts/**/*.${fonttypes}`)
};
// Destination directory for build, source directories for upload.
// Used by any build tasks.
var buildtarget = {
pages: build,
templates: path.join(build, 'templates/'),
content: path.join(build, 'content/'),
css: path.join(build, 'css/'),
js: path.join(build, 'js/'),
bowerjs: path.join(build, 'dist/js/'),
bowercss: path.join(build, 'dist/css/'),
images: path.join(build, 'images/'),
fonts: path.join(build, 'fonts/')
};
// Used by push.js. Note that for the most part,
// upload srcs are the same as built targets.
var uploadsrc = {
index: path.join(buildtarget.pages, 'index.html'),
pages: [path.join(buildtarget.pages, '*.html'), path.join('!', buildtarget.pages, 'index.html')],
templates: path.join(buildtarget.templates, '*.html'),
content: path.join(buildtarget.content, '*.html'),
css: path.join(buildtarget.css, '*.css'),
js: path.join(buildtarget.js, '*.js'),
bowerjs: buildtarget.bowerjs.concat('**/*.js'),
bowercss: buildtarget.bowercss.concat('**/*.css'),
files: [path.join(build, `images/**/*.${imagetypes}`), path.join(build, `fonts/**/*.${fonttypes}`)]
};
var secure = ''; // Change to 's' to enable secure html
// URLs used by realtive2absolute
var urls = {
standard: `http${secure}://${teaminfo.year}.igem.org/Team:${teaminfo.teamName}`,
template: `http${secure}://${teaminfo.year}.igem.org/Template:${teaminfo.teamName}`,
js: `http${secure}://${teaminfo.year}.igem.org/Template:${teaminfo.teamName}/js`,
css: `http${secure}://${teaminfo.year}.igem.org/Template:${teaminfo.teamName}/css`,
files: `http${secure}://${teaminfo.year}.igem.org/File:T--${teaminfo.teamName}--{0}`,
};
// Suffixes used by relative2absolute
var suffixes = {
js: '?action=raw&ctype=text/javascript',
css: '?action=raw&ctype=text/css'
};
/*tooltip*/
const glossary = {
"Autoinducer-2": ["A universal signaling molecule used by microorganisms to coordinate group behavior through quorum sensing."],
"autoinduction": ["The activation of a phenotype without external stimuli."],
"biofilms": ["A protective, adhesive matrix of polymers typically produced after quorum activation."],
"E.coli": ["Escherichia coli. A commonly used chassis also found in the human gut microbiome."],
"LsrACDB": ["Active import protein for AI-2."],
"LsrK": ["AI-2 kinase, which catalyzes the phosphorylation of A1-2 to phospho-AI-2."],
"Lsr operon": ["LuxS Regulated (Lsr) operon responsive to AI-2."],
"LuxS": ["An enzyme closely linked to the production of AI-2."],
"operon": ["A functional unit of DNA containing a cluster of genes under the control of a single promoter."],
"phosphorylation": [" The addition of a phosphate group to an organic compound. "],
"pLsr": ["The bidirectional promoter of the Lsr Operon."],
"quorum sensing": ["The ability to detect and to respond to cell population density by gene regulation."],
"sfGFP": ["superfolding Green Fluorescent Protein"],
"T7 RNA Polymerase" : ["An RNA polymerase from the T7 bacteriophage is highly selective for the pT7 promoter."],
"virulence": ["The likelihood of a microbe to cause disease based on its phenotypic state."],
"YdgG": ["Active export protein for AI-2."]
};
var handlebarsHelpers = function(file, t) {
return {
contentpath: function(context) {
//if(environment.relative2absolute) {
//return urls.template + '/' + path.basename(file.path, '.html') + suffixes.js;
//}
//else {
return path.posix.join('/content/', path.basename(file.path));
//}
},
url: function(context1, context2) {
if(environment.relative2absolute) {
return urls[context1] + '/' + path.basename(context2, '.html') + suffixes.js;
}
else {
return path.posix.join('/content/', path.basename(context2));
}
return '';
},
define: function(context) {
if (context in glossary) {
var word_short_definition = glossary[context][0];
var word_long_definition = glossary[context][1];
return `<span class="tooltip">${context}<span class="shortdef">${word_short_definition}</span><span class="longdef" tabindex = "1">${word_long_definition}</span> </span>`;
}
else {
return context;
}
}
};
};
var markdownOptions = {
sanitize: false
};
return {
teaminfo: teaminfo,
uploadmap: path.join(root, 'uploadmap.json'),
gulp: {
unit: './gulp/tasks/unit/*.js',
compound: './gulp/tasks/compound/*.js'
},
environment: environment, // Default to development environment, otherwise whatever is passed in
environments: environments,
targets: {
root: root,
clean: path.join(build, '/**'),
app: app,
build: build,
buildsrc: buildsrc,
buildtarget: buildtarget,
uploadsrc: uploadsrc,
urls: urls,
suffixes: suffixes,
},
browsersync: {
development: {
server: build,
port: 9999
}
},
handlebars: {
helpers: handlebarsHelpers
},
markdown: {
options: markdownOptions
},
browserslist: ["defaults"]
};
};