FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ionic/scripts/docs/gulp-tasks.js at angular-rc1 · Java1024/ionic · GitHub
Java1024
ionic
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ionic
/
scripts
/
docs
/
gulp-tasks.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
95 lines (84 loc) · 3.36 KB
Breadcrumbs
ionic
/
scripts
/
docs
/
gulp-tasks.js
Copy path
File metadata and controls
95 lines (84 loc) · 3.36 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
var
config
=
require
(
'../config.json'
)
;
module
.
exports
=
function
(
gulp
,
flags
)
{
gulp
.
task
(
'docs'
,
[
]
,
function
(
)
{
var
Dgeni
=
require
(
'dgeni'
)
;
var
semver
=
require
(
'semver'
)
;
var
docVersion
=
flags
[
'doc-version'
]
||
'nightly'
;
if
(
docVersion
!=
'nightly'
&&
!
semver
.
valid
(
docVersion
)
)
{
console
.
log
(
'Usage: gulp docs --doc-version=(nightly|versionName)\nversionName must be a valid semver version.'
)
;
return
process
.
exit
(
1
)
;
}
try
{
var
ionicPackage
=
require
(
'./dgeni-config'
)
(
docVersion
)
;
var
dgeni
=
new
Dgeni
(
[
ionicPackage
]
)
;
return
dgeni
.
generate
(
)
;
}
catch
(
err
)
{
console
.
log
(
err
.
stack
)
;
}
}
)
;
gulp
.
task
(
'docs.demos'
,
[
'demos'
,
'src'
,
'temp.hack'
]
,
function
(
)
{
return
gulp
.
src
(
[
'dist/**'
,
'!dist/e2e'
,
'!dist/e2e/**/*'
,
'!dist/ionic-site'
,
'!dist/ionic-site/**/*'
,
'!dist/src'
,
'!dist/src/**/*'
]
)
.
pipe
(
gulp
.
dest
(
config
.
docsDest
+
'/dist'
)
)
;
}
)
;
gulp
.
task
(
'docs.sass-variables'
,
function
(
)
{
var
fs
=
require
(
'fs'
)
;
var
gutil
=
require
(
'gulp-util'
)
;
var
es
=
require
(
'event-stream'
)
;
var
mkdirp
=
require
(
'mkdirp'
)
;
var
path
=
require
(
'path'
)
;
var
Entities
=
require
(
'html-entities'
)
.
AllHtmlEntities
;
entities
=
new
Entities
(
)
;
var
variables
=
[
]
;
var
outputFile
=
'tmp/sass.json'
;
// Add the variable to the array, encode the html and remove !default from the value
function
addVariable
(
variableName
,
defaultValue
,
file
)
{
defaultValue
=
entities
.
encode
(
defaultValue
)
;
defaultValue
=
defaultValue
.
replace
(
"!default;"
,
""
)
;
variables
.
push
(
{
"name"
:
variableName
,
"defaultValue"
:
defaultValue
.
trim
(
)
,
"file"
:
path
.
relative
(
'./'
,
file
.
path
)
}
)
;
}
return
gulp
.
src
(
'ionic/**/*.scss'
)
.
pipe
(
es
.
map
(
function
(
file
,
callback
)
{
var
contents
=
file
.
contents
.
toString
(
)
;
var
variableLine
,
variableName
,
defaultValue
,
multiline
;
fs
.
createReadStream
(
file
.
path
,
{
flags
:
'r'
}
)
.
pipe
(
es
.
split
(
)
)
.
pipe
(
es
.
map
(
function
(
line
,
callback
)
{
if
(
line
.
charAt
(
0
)
==
'$'
)
{
variableLine
=
line
.
split
(
/
:
(
.
+
)
/
)
;
variableName
=
variableLine
[
0
]
;
defaultValue
=
variableLine
[
1
]
;
// If there is a semicolon then it isn't a multiline value
multiline
=
line
.
indexOf
(
';'
)
>
-
1
?
false
:
true
;
if
(
!
multiline
&&
line
.
indexOf
(
'!default'
)
>
-
1
)
addVariable
(
variableName
,
defaultValue
,
file
)
;
}
else
if
(
multiline
==
true
)
{
defaultValue
+=
'\n'
+
line
;
// If the line has a semicolon then we've found the end of the value
if
(
line
.
indexOf
(
';'
)
>
-
1
&&
line
.
indexOf
(
'!default'
)
>
-
1
)
{
addVariable
(
variableName
,
defaultValue
,
file
)
;
multiline
=
false
;
}
}
callback
(
)
;
}
)
)
;
callback
(
)
;
}
)
.
on
(
'end'
,
function
(
)
{
gutil
.
log
(
"Writing to file at"
,
gutil
.
colors
.
cyan
(
"/driftyco/ionic2/"
+
outputFile
)
)
;
gutil
.
log
(
"Place this file in"
,
gutil
.
colors
.
cyan
(
"/driftyco/ionic-site/"
+
config
.
v2DocsDir
+
"/theming/overriding-ionic-variables/"
)
,
"in order to update the docs"
)
;
mkdirp
.
sync
(
'tmp'
)
;
fs
.
writeFileSync
(
outputFile
,
JSON
.
stringify
(
variables
)
)
;
}
)
)
;
}
)
;
}
Back
|
FazBrowse Home
|
New Git URL