From c532eac6b41b041f48194ad9afe7a5e37064efc9 Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Tue, 29 Sep 2015 09:01:24 +0200 Subject: Adding ids to headers, so as site puts anchor links --- tasks/cdn.js | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tasks') diff --git a/tasks/cdn.js b/tasks/cdn.js index 7a8ebba..73d7420 100644 --- a/tasks/cdn.js +++ b/tasks/cdn.js @@ -113,6 +113,12 @@ config.components.forEach(function (n) { .pipe(replace(/(src|href)=("|')(.*?)\.\.\/\.\.\//mg, '$1=$2../bower_components/')) // Remove the section with table-of-contents .pipe(replace(/^.*
[\s\S]*?table-of-contents[\s\S]*?<\/section>.*\n/im, '')) + // Add ids to headers, so as site configures permalinks + .pipe(replace(/(.*)(<\/h\d+>)/img, function($0, $1, $2, $3){ + var id = $2.trim().toLowerCase().replace(/[^\w]+/g,'_'); + return '' + $2 + $3; + })) + .pipe(gulp.dest(componentDoc)); }); }); -- cgit v1.2.3