/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/polytempl@1.0.3/index.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
#!/usr/bin/env node
"use strict";const vfs=require("vinyl-fs"),path=require("path"),through2=require("through2").obj,vinylFile=require("vinyl-file"),Builder=require("./file-builder"),builder=new Builder;var argv=require("yargs").usage("Usage: $0 <command> [options]").command("create <name> [path] [styles] [script]","Create a new Polymer template for element in current directory",{},createTemplate).describe("path","Path to directory relative to cwd where you want to create template").string("path").describe("styles","Extract styles to separate file. Can except file extension as argument ([css, scss, less])").alias("s","styles").describe("script","Extract script to separate file.").alias("j","script").describe("imports","Import dependencies using html comment").alias("i","imports").boolean("i").example("$0 create my-template ./custom_path/ -s scss -ji","Create template in ./custom_path/my-template with injected scss styles and script").help("h").alias("h","help").argv;function createTemplate(e){var t=path.normalize(__dirname+"/templates"),s=e.path?path.resolve(String(e.path)):process.cwd();if(e.name.search(/\s/)>=0)throw new Error("Provided name is not allowed");vfs.src(path.normalize(t+"/template.html")).pipe(through2((function(s,r,a){var i=String(s.contents).replace(/\{\{name}}/g,e.name);if(e.j||e.script){i=i.replace(/<script>[\s\S]*<\/script>/,`\x3c!-- inject scripts './${e.name}.js'--\x3e`);var n=vinylFile.readSync(path.normalize(t+"/template.js"),{base:t});n.contents=new Buffer(String(n.contents).replace(/\{\{name}}/g,e.name)),this.push(n)}if(e.s||e.styles){let s=e.s||e.styles||"css";if("string"==typeof s||!0!==e.s&&!0!==e.styles||(s="css"),["css","scss","less"].indexOf(s)<0)throw new Error("Provided styles extension is incorrect");i=i.replace(/<style>[\s\S]*<\/style>/,`\x3c!-- inject styles './${e.name}.${s}'--\x3e`),this.push(vinylFile.readSync(path.normalize(t+`/template.${s}`),{base:t}))}(e.i||e.imports)&&(i="\x3c!--import [polymer]--\x3e\n\n"+i),s.contents=new Buffer(i),a(null,s)}))).pipe(through2((function(t,s,r){t.basename=`${e.name}${t.extname}`,r(null,t)}))).pipe(vfs.dest(path.normalize(`${s}/${e.name}/`)))}module.exports=function(e,t){return builder.start(e,t)};
//# sourceMappingURL=/sm/0fbf64f32d189ee53d529a0b85628c8a29c57043a70294a1b06c597e03bb079b.map