Skip to content

Commit b574a21

Browse files
committed
killing jekyll
1 parent 3365044 commit b574a21

5,209 files changed

Lines changed: 11 additions & 1624359 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gemfile

Lines changed: 0 additions & 5 deletions
This file was deleted.

Gemfile.lock

Lines changed: 0 additions & 67 deletions
This file was deleted.

Gulpfile.js

Lines changed: 6 additions & 198 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ const uglify = require('gulp-uglify');
2323

2424
var bustingCache = false;
2525

26-
var messages = {
27-
jekyllBuild: '<span style="color: grey">Running:</span> $ jekyll build'
28-
};
2926

3027
var AUTOPREFIXER_BROWSERS = [
3128
'ie >= 10',
@@ -60,9 +57,6 @@ function bustCache() {
6057
return [
6158
cacheBust('server/pages/_includes/', 'head.html'),
6259
cacheBust('server/pages/_includes/', 'scripts.html'),
63-
cacheBust('content/_includes/', 'head_includes.html'),
64-
cacheBust('content/_includes/fluid/', 'head.html'),
65-
cacheBust('content/_includes/fluid/', 'footer_tags.html')
6660
];
6761
};
6862

@@ -110,12 +104,10 @@ gulp.task('styles:others', function() {
110104
.pipe(prefix({browsers: AUTOPREFIXER_BROWSERS}))
111105
.pipe($.sourcemaps.write())
112106
.pipe(gulp.dest('content/css/'))
113-
.pipe(gulp.dest('_site/css/'))
114107
// Concatenate and minify styles
115108
.pipe(cleanCSS({compatibility: 'ie8'}))
116109
.pipe(rename({extname: '.min.css'}))
117110
.pipe(gulp.dest('content/css/'))
118-
.pipe(gulp.dest('_site/css/'))
119111
.pipe($.size({title: 'styles'}));
120112
});
121113

@@ -132,12 +124,10 @@ gulp.task('styles:v2', function() {
132124
.pipe(concat('styles.css'))
133125
.pipe($.sourcemaps.write())
134126
.pipe(gulp.dest('content/css/'))
135-
.pipe(gulp.dest('_site/css/'))
136127
// Concatenate and minify styles
137128
.pipe(cleanCSS({compatibility: 'ie8'}))
138129
.pipe(rename({extname: '.min.css'}))
139130
.pipe(gulp.dest('content/css/'))
140-
.pipe(gulp.dest('_site/css/'))
141131
.pipe($.size({title: 'styles'}));
142132
});
143133

@@ -146,13 +136,11 @@ gulp.task('styles:v1', function() {
146136
.pipe(sass({onError: browserSync.notify}))
147137
.pipe(prefix({browsers: AUTOPREFIXER_BROWSERS}))
148138
.pipe(gulp.dest('content/css/'))
149-
.pipe(gulp.dest('_site/css/'))
150139
.pipe(minifyCss({
151140
keepSpecialComments: 0
152141
}))
153142
.pipe(rename({extname: '.min.css'}))
154143
.pipe(gulp.dest('content/css/'))
155-
.pipe(gulp.dest('_site/css/'));
156144
});
157145

158146
// compress and concat JS
@@ -164,11 +152,9 @@ gulp.task('js', function() {
164152
.pipe(footer(closureEnd))
165153
.pipe($.sourcemaps.write())
166154
.pipe(gulp.dest('content/js'))
167-
.pipe(gulp.dest('_site/js'))
168155
.pipe(uglify())
169156
.pipe(rename({extname: '.min.js'}))
170157
.pipe(gulp.dest('content/js'))
171-
.pipe(gulp.dest('_site/js'))
172158
.pipe($.size({title: 'js'}));
173159
});
174160

@@ -185,10 +171,7 @@ gulp.task('stencil', function(done) {
185171
stdio: 'inherit'
186172
}
187173
)
188-
.on('close', async function() {
189-
await gulp
190-
.src('content/js/stencil/*')
191-
.pipe(gulp.dest('_site/js/stencil/'))
174+
.on('close', async () => {
192175
done();
193176
}).on('error', function(err) {
194177
console.log(err)
@@ -200,42 +183,13 @@ gulp.task('stencil:clean', function(done) {
200183
return runSequence('stencil', 'js', done);
201184
})
202185

203-
/**
204-
* Build the Jekyll Site
205-
*/
206-
gulp.task('jekyll-build', [], function(done) {
207-
browserSync.notify(messages.jekyllBuild);
208-
return cp.spawn('bundle',
209-
['exec', 'jekyll', 'build', '-I', '--config', '_config.yml'],
210-
{stdio: 'inherit'})
211-
.on('close', function() {
212-
done();
213-
}).on('error', function(err) { throw err; });
214-
});
215-
216-
gulp.task('jekyll-build.clean', [], function(done) {
217-
browserSync.notify(messages.jekyllBuild);
218-
return cp.spawn('bundle',
219-
['exec', 'jekyll', 'build', '-I', '--config', '_config.yml'],
220-
{stdio: 'inherit'})
221-
.on('close', function() {
222-
done();
223-
}).on('error', function(err) {throw err; });
224-
});
225-
226186
/**
227187
* Run Generate linkchecker page
228188
*/
229189
gulp.task('linkchecker', ['build'],
230190
shell.task('_scripts/linkchecker.sh', {verbose: true})
231191
);
232192

233-
/**
234-
* Rebuild Jekyll & do page reload
235-
*/
236-
gulp.task('jekyll-rebuild', ['jekyll-build'], function() {
237-
browserSync.reload();
238-
});
239193

240194
gulp.task('server-listen', function() {
241195
return server.listen({'path': './server.js', 'execArgv': ['--inspect']},
@@ -269,10 +223,6 @@ gulp.task('watch.max', ['server'], function() {
269223
gulp.watch(['assets/scss/**/*.scss', '!assets/scss/styles.scss',
270224
'!assets/scss/**/_*.scss'], ['server:others']);
271225
gulp.watch(['assets/js/**/*.js'], ['server:js']);
272-
gulp.watch(['content/**/*.{md,html}','content/docs/**/*.{js,css,json}',
273-
'!content/v1/**/*.*', '!content/2.*/**/*.*', '!content/3.{0,1,2,3,4}.*/**/*.*',
274-
'!content/_includes/head_includes.*', '!content/_includes/fluid/head.*',
275-
'!content/_includes/fluid/footer_tags.*'], ['jekyll-rebuild']);
276226
});
277227

278228
gulp.task('watch', ['server'], function() {
@@ -283,8 +233,6 @@ gulp.task('watch', ['server'], function() {
283233
gulp.watch(['assets/js/**/*.js'], ['server:js']);
284234
gulp.watch(['assets/stencil/**/*.{ts,tsx,scss}', '!assets/stencil/components.d.ts'],
285235
['server:stencil']);
286-
gulp.watch(['content/_layouts/*/*','content/_includes/**/*',
287-
'content/img/**/*', 'content/docs/appflow/**/*.{md,html}'], ['jekyll-rebuild']);
288236
});
289237

290238
gulp.task('sitemap', function () {
@@ -303,158 +251,19 @@ gulp.task('sitemap', function () {
303251
// verbose: true,
304252
lastmod: false
305253
}))
306-
.pipe(gulp.dest('content/'))
307-
.pipe(gulp.dest('_site/'));
308-
});
309-
310-
gulp.task('docs.index', function() {
311-
var lunr = require('lunr');
312-
var es = require('event-stream');
313-
var yaml = require('js-yaml');
314-
var htmlparser = require('htmlparser2');
315-
var mkdirp = require('mkdirp');
316-
var fs = require('fs');
317-
318-
var idx = lunr(function() {
319-
this.field('path');
320-
this.field('title', {boost: 10});
321-
this.field('body');
322-
this.ref('id');
323-
});
324-
var ref = {};
325-
var refId = 0;
326-
327-
function addToIndex(path, title, layout, body) {
328-
// Add the data to the indexer and ref object
329-
idx.add({'path': path, 'body': body, 'title': title, id: refId});
330-
ref[refId] = {'p': path, 't': title, 'l': layout};
331-
refId++;
332-
}
333-
334-
var docPath = 'content/docs/';
335-
336-
return gulp.src([
337-
docPath + '/{api,cli,components,faq,getting-started,native,resources,theming,utils}/**/*.{md,html,markdown}',
338-
docPath + '/index.md',
339-
])
340-
.pipe(es.map(function(file, callback) {
341-
//docs for gulp file objects: https://github.com/wearefractal/vinyl
342-
var contents = file.contents.toString(); //was buffer
343-
344-
// Grab relative path from ionic-site root
345-
var relpath = file.path
346-
.replace(__dirname + '/content/docs/', '')
347-
348-
// Read out the yaml portion of the Jekyll file
349-
var yamlStartIndex = contents.indexOf('---');
350-
351-
if (yamlStartIndex === -1) {
352-
return callback();
353-
}
354-
355-
// read Jekyll's page yaml variables at the top of the file
356-
var yamlEndIndex = contents.indexOf('---', yamlStartIndex+3); //starting from start
357-
var yamlRaw = contents.substring(yamlStartIndex+3, yamlEndIndex);
358-
359-
var pageData = yaml.safeLoad(yamlRaw);
360-
if(!pageData.title || !pageData.layout) {
361-
return callback();
362-
}
363-
364-
// manually set to not be searchable, or for a blog post, manually set to be searchable
365-
if(pageData.searchable === false || (pageData.layout == 'post' && pageData.searchable !== true)) {
366-
return callback();
367-
}
368-
369-
// clean up some content so code variables are searchable too
370-
contents = contents.substring(yamlEndIndex+3);
371-
contents = contents.replace(/<code?>/gi, '');
372-
contents = contents.replace(/<\/code>/gi, '');
373-
contents = contents.replace(/<code?></gi, '');
374-
contents = contents.replace(/><\/code>/gi, '');
375-
contents = contents.replace(/`</gi, '');
376-
contents = contents.replace(/>`/gi, '');
377-
378-
// create a clean path to the URL
379-
var path = '/' + relpath.replace('index.md', '')
380-
.replace('index.html', '')
381-
.replace('.md', '.html')
382-
.replace('.markdown', '.html');
383-
if(pageData.layout == 'post') {
384-
path = '/blog/' + path.substring(19).replace('.html', '/');
385-
}
386-
387-
var parser;
388-
if(pageData.search_sections === true) {
389-
// each section within the content should be its own search result
390-
var section = { body: '', title: '' };
391-
var isTitleOpen = false;
392-
393-
parser = new htmlparser.Parser({
394-
ontext: function(text){
395-
if(isTitleOpen) {
396-
section.title += text; // get the title of this section
397-
} else {
398-
section.body += text.replace(/{%.*%}/, '', 'g'); // Ignore any Jekyll expressions
399-
}
400-
},
401-
onopentag: function(name, attrs) {
402-
if(name == 'section' && attrs.id) {
403-
// start building new section data
404-
section = { body: '', path: path + '#' + attrs.id, title: '' };
405-
} else if( (name == 'h1' || name == 'h2' || name == 'h3') && attrs.class == 'title') {
406-
isTitleOpen = true; // the next text will be this sections title
407-
}
408-
},
409-
onclosetag: function(name) {
410-
if(name == 'section') {
411-
// section closed, index this section then clear it out
412-
addToIndex(section.path, section.title, pageData.layout, section.body);
413-
section = { body: '', title: '' };
414-
} else if( (name == 'h1' || name == 'h2' || name == 'h3') && isTitleOpen) {
415-
isTitleOpen = false;
416-
}
417-
}
418-
});
419-
parser.write(contents);
420-
parser.end();
421-
422-
} else {
423-
// index the entire page
424-
var body = '';
425-
parser = new htmlparser.Parser({
426-
ontext: function(text){
427-
body += text.replace(/{%.*%}/, '', 'g'); // Ignore any Jekyll expressions
428-
}
429-
});
430-
parser.write(contents);
431-
parser.end();
432-
433-
addToIndex(path, pageData.title, pageData.layout, body);
434-
}
435-
436-
callback();
437-
438-
})).on('end', function() {
439-
// Write out as one json file
440-
mkdirp.sync(docPath + '/data');
441-
fs.writeFileSync(
442-
docPath + '/data/index.json',
443-
JSON.stringify({'ref': ref, 'index': idx.toJSON()})
444-
);
445-
});
254+
.pipe(gulp.dest('content/'));
446255
});
447256

448257
gulp.task('build', ['build-prep'], function(done) {
449-
runSequence('jekyll-build', function() {
258+
// runSequence('jekyll-build', function() {
450259
done();
451-
})
260+
// })
452261
});
453262

454263
gulp.task('build.clean', ['build-prep'], function(done) {
455-
runSequence('jekyll-build.clean', function() {
264+
// runSequence('jekyll-build.clean', function() {
456265
done();
457-
});
266+
// });
458267
});
459268

460269
gulp.task('slug.prep', function () {
@@ -468,7 +277,6 @@ gulp.task(
468277
'styles:v1',
469278
'styles:v2',
470279
'styles:others',
471-
'docs.index',
472280
],
473281
bustCache
474282
);

0 commit comments

Comments
 (0)