Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
node-slate
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nguyễn Hải Sơn
node-slate
Commits
4c821c92
Commit
4c821c92
authored
Aug 05, 2016
by
Simon Bartlett
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extracted getData method
parent
78cdba60
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
26 deletions
+30
-26
gulpfile.js
gulpfile.js
+30
-26
No files found.
gulpfile.js
View file @
4c821c92
...
@@ -33,6 +33,35 @@ var readIndexYml = function() {
...
@@ -33,6 +33,35 @@ var readIndexYml = function() {
return
yaml
.
safeLoad
(
fs
.
readFileSync
(
'./source/index.yml'
,
'utf8'
));
return
yaml
.
safeLoad
(
fs
.
readFileSync
(
'./source/index.yml'
,
'utf8'
));
};
};
var
getPageData
=
function
()
{
var
config
=
readIndexYml
();
var
includes
=
config
.
includes
.
map
(
function
(
include
)
{
return
'./source/includes/'
+
include
+
'.md'
;
})
.
map
(
function
(
include
)
{
return
fs
.
readFileSync
(
include
,
'utf8'
);
})
.
map
(
function
(
include
)
{
return
marked
(
include
,
{
renderer
:
renderer
});
});
return
{
current_page
:
{
data
:
config
},
page_classes
:
''
,
includes
:
includes
,
image_tag
:
function
(
filename
,
alt
,
className
)
{
return
'<img alt="'
+
alt
+
'" class="'
+
className
+
'" src="images/'
+
filename
+
'">'
;
},
javascript_include_tag
:
function
(
name
)
{
return
'<script src="javascripts/'
+
name
+
'.js" type="text/javascript"></script>'
;
},
stylesheet_link_tag
:
function
(
name
,
media
)
{
return
'<link href="stylesheets/'
+
name
+
'.css" rel="stylesheet" type="text/css" media="'
+
media
+
'" />'
;
},
langs
:
(
config
.
language_tabs
||
[]).
map
(
function
(
lang
)
{
return
typeof
lang
==
'string'
?
lang
:
lang
.
keys
.
first
;
})
};
};
gulp
.
task
(
'clean'
,
function
()
{
gulp
.
task
(
'clean'
,
function
()
{
return
del
([
'build/*'
]);
return
del
([
'build/*'
]);
});
});
...
@@ -89,32 +118,7 @@ gulp.task('highlightjs', function () {
...
@@ -89,32 +118,7 @@ gulp.task('highlightjs', function () {
});
});
gulp
.
task
(
'html'
,
function
()
{
gulp
.
task
(
'html'
,
function
()
{
var
config
=
readIndexYml
();
var
data
=
getPageData
();
var
includes
=
config
.
includes
.
map
(
function
(
include
)
{
return
'./source/includes/'
+
include
+
'.md'
;
})
.
map
(
function
(
include
)
{
return
fs
.
readFileSync
(
include
,
'utf8'
);
})
.
map
(
function
(
include
)
{
return
marked
(
include
,
{
renderer
:
renderer
});
});
var
data
=
{
current_page
:
{
data
:
config
},
page_classes
:
''
,
includes
:
includes
,
image_tag
:
function
(
filename
)
{
return
'<img src="images/'
+
filename
+
'">'
;
},
javascript_include_tag
:
function
(
name
)
{
return
'<script src="javascripts/'
+
name
+
'.js" type="text/javascript"></script>'
;
},
stylesheet_link_tag
:
function
(
name
,
media
)
{
return
'<link href="stylesheets/'
+
name
+
'.css" rel="stylesheet" type="text/css" media="'
+
media
+
'" />'
;
},
langs
:
(
config
.
language_tabs
||
[]).
map
(
function
(
lang
)
{
return
typeof
lang
==
'string'
?
lang
:
lang
.
keys
.
first
;
})
};
return
gulp
.
src
(
'./source/*.html'
)
return
gulp
.
src
(
'./source/*.html'
)
.
pipe
(
ejs
(
data
).
on
(
'error'
,
gutil
.
log
))
.
pipe
(
ejs
(
data
).
on
(
'error'
,
gutil
.
log
))
.
pipe
(
gulpif
(
COMPRESS
,
prettify
({
indent_size
:
2
})))
.
pipe
(
gulpif
(
COMPRESS
,
prettify
({
indent_size
:
2
})))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment