mirror of
https://github.com/jgthms/bulma
synced 2026-03-18 03:14:30 -07:00
Read derived variables
This commit is contained in:
30
docs/scripts/01-read-initial-variables.js
Normal file
30
docs/scripts/01-read-initial-variables.js
Normal file
@@ -0,0 +1,30 @@
|
||||
module.exports = plugin;
|
||||
|
||||
const utils = require('./utils');
|
||||
|
||||
function plugin() {
|
||||
let variables = {
|
||||
by_name: {},
|
||||
};
|
||||
|
||||
return (files, metalsmith, done) => {
|
||||
setImmediate(done);
|
||||
|
||||
Object.keys(files).forEach(file_path => {
|
||||
const {file_name, lines} = utils.getLines(files, file_path);
|
||||
|
||||
variables[file_name] = [];
|
||||
|
||||
lines.forEach(line => {
|
||||
const variable = utils.parseLine(line);
|
||||
|
||||
if (variable != false) {
|
||||
variables.by_name[variable.name] = variable;
|
||||
variables.list.push(variable.name);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
utils.writeFile(utils.files.initial_variables, variables);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user