mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
docs(): changing the sass variable path to be relative in order to link to it
Don’t add the variable if it doesn’t contain the !default flag, and remove the !default flag and semicolon from the value. References #122
This commit is contained in:
@ -181,14 +181,15 @@ module.exports = function(gulp, flags) {
|
|||||||
var variables = [];
|
var variables = [];
|
||||||
var outputFile = 'dist/ionic-site/docs/v2/data/sass.json';
|
var outputFile = 'dist/ionic-site/docs/v2/data/sass.json';
|
||||||
|
|
||||||
// TODO this pushes the file it is defined in, not any files used in
|
// Add the variable to the array, encode the html and remove !default from the value
|
||||||
// not sure if we should include both
|
|
||||||
function addVariable(variableName, defaultValue, file) {
|
function addVariable(variableName, defaultValue, file) {
|
||||||
defaultValue = entities.encode(defaultValue);
|
defaultValue = entities.encode(defaultValue);
|
||||||
|
defaultValue = defaultValue.replace("!default;", "");
|
||||||
|
|
||||||
variables.push({
|
variables.push({
|
||||||
"name": variableName,
|
"name": variableName,
|
||||||
"defaultValue": defaultValue.trim(),
|
"defaultValue": defaultValue.trim(),
|
||||||
"file": path.basename(file.path)
|
"file": path.relative('./', file.path)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,13 +209,13 @@ module.exports = function(gulp, flags) {
|
|||||||
// If there is a semicolon then it isn't a multiline value
|
// If there is a semicolon then it isn't a multiline value
|
||||||
multiline = line.indexOf(';') > -1 ? false : true;
|
multiline = line.indexOf(';') > -1 ? false : true;
|
||||||
|
|
||||||
if (!multiline)
|
if (!multiline && line.indexOf('!default') > -1)
|
||||||
addVariable(variableName, defaultValue, file);
|
addVariable(variableName, defaultValue, file);
|
||||||
} else if (multiline == true) {
|
} else if (multiline == true) {
|
||||||
defaultValue += '\n' + line;
|
defaultValue += '\n' + line;
|
||||||
|
|
||||||
// If the line has a semicolon then we've found the end of the default value
|
// If the line has a semicolon then we've found the end of the value
|
||||||
if (line.indexOf(';') > -1) {
|
if (line.indexOf(';') > -1 && line.indexOf('!default') > -1) {
|
||||||
addVariable(variableName, defaultValue, file);
|
addVariable(variableName, defaultValue, file);
|
||||||
multiline = false;
|
multiline = false;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user