예제 #1
0
        public static void RunTailwind(
            this IApplicationBuilder applicationBuilder,
            string script)
        {
            if (applicationBuilder == null)
            {
                throw new ArgumentNullException(nameof(applicationBuilder));
            }

            var executable = "npm";
            var args       = new List <string>();

            if (OperatingSystem.IsWindows())
            {
                executable = "cmd";
                args.Add("/c");
                args.Add("npm");
            }

            args.Add("run");
            args.Add(script);

            var nodeRunner = new NodeRunner(executable, args.ToArray());
        }
예제 #2
0
        public static void RunTailwind(
            this IApplicationBuilder applicationBuilder,
            string inputCssPath  = "./Styles/tailwind.css",
            string outputCssPath = "./wwwroot/css/tailwind.css",
            bool watch           = true)
        {
            if (applicationBuilder == null)
            {
                throw new ArgumentNullException(nameof(applicationBuilder));
            }

            EnsureConfiguration(inputCssPath);

            var executable = "npx";
            var args       = new List <string>();

            if (OperatingSystem.IsWindows())
            {
                executable = "cmd";
                args.Add("/c");
                args.Add("npx");
            }

            args.Add("tailwindcss");
            args.Add("-i");
            args.Add(inputCssPath);
            args.Add("-o");
            args.Add(outputCssPath);

            if (watch)
            {
                args.Add("--watch");
            }

            var nodeRunner = new NodeRunner(executable, args.ToArray());
        }