JSFiddle - React, Tailwind, and code Playground
by Emily Humphrey
JavaScript
var paths = {
src: {
assets: "./src/assets/",
css: "./src/scss/",
js: "./src/js/",
html: "./src/pug/",
modules: "./src/modules/"
},
dist: {
assets: "./dist/assets/",
css: "./dist/scss/",
js: "./dist/js/",
html: "./dist/pug/"
}
};
var file_names = {
assets: {
compile: ['**/*.*', '**/_*.*'],
ignore: [],
watch: ['**/*.*', '**/_*.*']
},
css: {
compile: ['**/*.scss', '**/*.css'],
ignore: [],
watch: ['**/*.scss', '**/*.css']
},
js: {
compile: ['**/*.js', '**/*.json'],
ignore: ['**/_*.js'],
watch: ['**/*.js', '**/*.json', '**/_*.js']
},
html: {
compile: ['**/*.pug', '**/*.html'],
ignore: ['**/_*.pug', '**/_*.html'],
watch: ['**/*.pug', '**/*.html', '**/_*.pug']
}
}
function get_file_paths(file_type){
console.log(file_type);
console.log(file_names)
var src_path = paths.src[file_type];
var modules_path = paths.src.modules;
var dist_path = paths.dist[file_type];
var file_names = file_names[file_type];
function get_source(){
var arr = [];
file_names.compile.forEach(function(item){
arr.push(src_path+item);
});
file_names.ignore.forEach(function(item){
arr.push("!"+src_path+item);
});
}
function get_watch(){
file_names.watch.forEach(function(item){
arr.push(src_path+item);
arr.push(modules_path+item);
});
}
return{
source: get_source(),
dist: dist_path,
watch: get_watch()
}
}
console.log(get_file_paths("js"))