mirror of
https://github.com/jgthms/bulma.git
synced 2024-11-28 12:24:23 +00:00
31 lines
646 B
JavaScript
31 lines
646 B
JavaScript
module.exports = plugin;
|
|
|
|
const utils = require('./utils');
|
|
|
|
function plugin() {
|
|
|
|
return (files, metalsmith, done) => {
|
|
setImmediate(done);
|
|
|
|
Object.keys(files).forEach(file_path => {
|
|
const {file_name, lines} = utils.getLines(files, file_path);
|
|
let variables = {
|
|
by_name: {},
|
|
list: [],
|
|
file_path,
|
|
};
|
|
|
|
lines.forEach(line => {
|
|
const variable = utils.parseLine(line);
|
|
|
|
if (variable != false) {
|
|
variables.by_name[variable.name] = variable;
|
|
variables.list.push(variable.name);
|
|
}
|
|
});
|
|
|
|
utils.writeFile(file_path, variables);
|
|
});
|
|
};
|
|
}
|