Skip to content

Commit

Permalink
perf(titlecase): lazy require (#4417)
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Jul 14, 2020
1 parent e3baad9 commit 89b2a9a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/plugins/filter/before_post_render/titlecase.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
'use strict';

const titlecase = require('titlecase');
let titlecase;

function titlecaseFilter(data) {
if (!this.config.titlecase || !data.title) return;

if (!titlecase) titlecase = require('titlecase');
data.title = titlecase(data.title);
}

Expand Down

0 comments on commit 89b2a9a

Please sign in to comment.