Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Sparky.task('static', () => {
const watchPaths = Array.isArray(staticDirs)
? staticDirs.map(pathPublic => pathPublic + '/**/*')
: staticDirs + '/**/*';
const publicArray = Array.isArray(staticDirs) ? staticDirs : [staticDirs];
return Sparky.watch(watchPaths).file(``, file => {
let root = publicArray.find(
element => file.root.substr(0, element.length) == element
);
let relativePath = root ? path.relative(root, file.root) : '';
file.copy(path.join(targetDir, relativePath));
});
});
const transformer = new ConfigurationTransformer();
const html = transformer.applyTransform([{
inHead: true,
order: 1,
element: 'style',
content: new cleanCss({}).minify(_sass.css.toString()).styles,
attributes: {
id: 'primary-styles'
}
}], index.toString());
writeFileSync(indexPath, html);
}
src = isProdBuild || isBuildServer
? Sparky.src('src/client/styles/**/**/*.scss').file('main.scss', process)
: Sparky.watch('src/client/styles/**/**/*.scss').file('main.scss', process)
return src
})
Sparky.task('static', () => {
const watchPaths = Array.isArray(staticDirs)
? staticDirs.map(pathPublic => pathPublic + '/**/*')
: staticDirs + '/**/*';
const publicArray = Array.isArray(staticDirs) ? staticDirs : [staticDirs];
return Sparky.watch(watchPaths).file(``, file => {
let root = publicArray.find(
element => file.root.substr(0, element.length) == element
);
let relativePath = root ? path.relative(root, file.root) : '';
file.copy(path.join(targetDir, relativePath));
});
});
Sparky.task("watch-assets", () => Sparky.watch("./assets", {
base: "./code"
}).dest("./dist"));
Sparky.task("copy-assets", () => Sparky.src("./assets", {
Sparky.task("watch-assets", () => Sparky.watch("./assets", { base: "./src" }).dest("./dist"));
Sparky.task("copy-assets", () => Sparky.src("./assets", { base: "./src" }).dest("./dist"));