JSFiddle - React, Tailwind, and code Playground
by Emily Humphrey
JavaScript
var file_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_names[file_type+''])
var src_path = file_paths.src[file_type];
var modules_path = file_paths.src.modules;
var dist_path = file_paths.dist[file_type];
var names = file_names[file_type+''];
function get_source(){
var arr = [];
names.compile.forEach(function(item){
arr.push(src_path+item);
});
names.ignore.forEach(function(item){
arr.push("!"+src_path+item);
});
return arr;
}
function get_watch(){
var arr = [];
names.watch.forEach(function(item){
arr.push(src_path+item);
arr.push(modules_path+item);
});
return arr;
}
return{
source: get_source(),
dist: dist_path,
watch: get_watch()
}
}
console.log(get_file_paths("js"))