mikemorris revised this gist 1 week ago. Go to revision
1 file changed, 4 insertions, 4 deletions
ecosystem.config.js
| @@ -1,12 +1,12 @@ | |||
| 1 | 1 | { | |
| 2 | 2 | [ | |
| 3 | 3 | { | |
| 4 | - | name : "jade-compiler", | |
| 5 | - | script : "/opt/builder/jade-compiler.js" | |
| 4 | + | "name" : "jade-compiler", | |
| 5 | + | "script" : "/opt/builder/jade-compiler.js" | |
| 6 | 6 | }, | |
| 7 | 7 | { | |
| 8 | - | name : "sass-compiler", | |
| 9 | - | script : "/opt/builder/sass-compiler.js" | |
| 8 | + | "name" : "sass-compiler", | |
| 9 | + | "script" : "/opt/builder/sass-compiler.js" | |
| 10 | 10 | } | |
| 11 | 11 | ] | |
| 12 | 12 | } | |
mikemorris revised this gist 1 week ago. Go to revision
1 file changed, 1 insertion, 1 deletion
ecosystem.config.js
| @@ -1,5 +1,5 @@ | |||
| 1 | 1 | { | |
| 2 | - | apps : [ | |
| 2 | + | [ | |
| 3 | 3 | { | |
| 4 | 4 | name : "jade-compiler", | |
| 5 | 5 | script : "/opt/builder/jade-compiler.js" | |
mikemorris revised this gist 1 week ago. Go to revision
1 file changed, 1 insertion, 1 deletion
ecosystem.config.js
| @@ -1,4 +1,4 @@ | |||
| 1 | - | module.exports = { | |
| 1 | + | { | |
| 2 | 2 | apps : [ | |
| 3 | 3 | { | |
| 4 | 4 | name : "jade-compiler", | |
mikemorris revised this gist 1 week ago. Go to revision
1 file changed, 12 insertions
ecosystem.config.js(file created)
| @@ -0,0 +1,12 @@ | |||
| 1 | + | module.exports = { | |
| 2 | + | apps : [ | |
| 3 | + | { | |
| 4 | + | name : "jade-compiler", | |
| 5 | + | script : "/opt/builder/jade-compiler.js" | |
| 6 | + | }, | |
| 7 | + | { | |
| 8 | + | name : "sass-compiler", | |
| 9 | + | script : "/opt/builder/sass-compiler.js" | |
| 10 | + | } | |
| 11 | + | ] | |
| 12 | + | } | |
mikemorris revised this gist 1 week ago. Go to revision
1 file changed, 5 insertions, 3 deletions
tailwindcss-compiler.js
| @@ -27,7 +27,7 @@ async function build() { | |||
| 27 | 27 | log('-----------------------'); | |
| 28 | 28 | ||
| 29 | 29 | const tailwindoptions = { | |
| 30 | - | content: ["/app/views/**/*.jade"], | |
| 30 | + | content: [], | |
| 31 | 31 | theme: { | |
| 32 | 32 | extend: {}, | |
| 33 | 33 | }, | |
| @@ -38,7 +38,7 @@ try { | |||
| 38 | 38 | // Input CSS with Tailwind directives | |
| 39 | 39 | const inputCSS = ` | |
| 40 | 40 | @import "tailwindcss" source(none); | |
| 41 | - | @source "/www/**/*.html"; | |
| 41 | + | @source "/www/**/*.{html,js}"; | |
| 42 | 42 | `; | |
| 43 | 43 | ||
| 44 | 44 | // Process with PostCSS | |
| @@ -49,7 +49,6 @@ try { | |||
| 49 | 49 | ||
| 50 | 50 | // Write output CSS | |
| 51 | 51 | fse.outputFileSync("/www/css/tailwind.css", result.css); | |
| 52 | - | //fs.writeFileSync("dist/styles.css", result.css); | |
| 53 | 52 | console.log("Tailwind CSS compiled to /www/css/tailwind.css"); | |
| 54 | 53 | } catch (err) { | |
| 55 | 54 | console.error("Error building CSS:", err); | |
| @@ -87,6 +86,9 @@ function startWatcher(watchFolders) { | |||
| 87 | 86 | // | MAIN | |
| 88 | 87 | // ==================================================================== | |
| 89 | 88 | async function go() { | |
| 89 | + | const watchFolders = [ | |
| 90 | + | '/www/**/*.{html,js}' | |
| 91 | + | ] | |
| 90 | 92 | if (process.argv[2] == 'compile-and-watch') { | |
| 91 | 93 | await build(); | |
| 92 | 94 | startWatcher(); | |
mikemorris revised this gist 1 week ago. Go to revision
1 file changed, 3 insertions, 22 deletions
tailwindcss-compiler.js
| @@ -25,26 +25,7 @@ function log(message) { | |||
| 25 | 25 | // ==================================================================== | |
| 26 | 26 | async function build() { | |
| 27 | 27 | log('-----------------------'); | |
| 28 | - | ||
| 29 | - | const options = { | |
| 30 | - | logger: { | |
| 31 | - | warn(message, options) { | |
| 32 | - | if (options.span) { | |
| 33 | - | log('====================================================================================================================') | |
| 34 | - | log(`Warning when compiling: ${options.span.url.pathname}:`) | |
| 35 | - | log(` ${message}\n`) | |
| 36 | - | } | |
| 37 | - | }, | |
| 38 | - | debug(message, options) { | |
| 39 | - | if (options.span) { | |
| 40 | - | log('====================================================================================================================') | |
| 41 | - | log(`Debug message compiling: ${options.span.url.pathname}:`) | |
| 42 | - | log(` ${message}\n`) | |
| 43 | - | } | |
| 44 | - | } | |
| 45 | - | } | |
| 46 | - | } | |
| 47 | - | ||
| 28 | + | ||
| 48 | 29 | const tailwindoptions = { | |
| 49 | 30 | content: ["/app/views/**/*.jade"], | |
| 50 | 31 | theme: { | |
| @@ -56,8 +37,8 @@ async function build() { | |||
| 56 | 37 | try { | |
| 57 | 38 | // Input CSS with Tailwind directives | |
| 58 | 39 | const inputCSS = ` | |
| 59 | - | @import "tailwindcss"; | |
| 60 | - | /** ============================================ **/ | |
| 40 | + | @import "tailwindcss" source(none); | |
| 41 | + | @source "/www/**/*.html"; | |
| 61 | 42 | `; | |
| 62 | 43 | ||
| 63 | 44 | // Process with PostCSS | |
mikemorris revised this gist 1 week ago. Go to revision
1 file changed, 3 insertions, 5 deletions
tailwindcss-compiler.js
| @@ -53,12 +53,11 @@ async function build() { | |||
| 53 | 53 | plugins: [], | |
| 54 | 54 | }; | |
| 55 | 55 | ||
| 56 | - | try { | |
| 56 | + | try { | |
| 57 | 57 | // Input CSS with Tailwind directives | |
| 58 | 58 | const inputCSS = ` | |
| 59 | - | @tailwind base; | |
| 60 | - | @tailwind components; | |
| 61 | - | @tailwind utilities; | |
| 59 | + | @import "tailwindcss"; | |
| 60 | + | /** ============================================ **/ | |
| 62 | 61 | `; | |
| 63 | 62 | ||
| 64 | 63 | // Process with PostCSS | |
| @@ -76,7 +75,6 @@ async function build() { | |||
| 76 | 75 | } | |
| 77 | 76 | ||
| 78 | 77 | } | |
| 79 | - | ||
| 80 | 78 | // ==================================================================== | |
| 81 | 79 | // | | |
| 82 | 80 | // ==================================================================== | |
mikemorris revised this gist 1 week ago. Go to revision
1 file changed, 1 insertion, 1 deletion
tailwindcss-compiler.js
| @@ -70,7 +70,7 @@ async function build() { | |||
| 70 | 70 | // Write output CSS | |
| 71 | 71 | fse.outputFileSync("/www/css/tailwind.css", result.css); | |
| 72 | 72 | //fs.writeFileSync("dist/styles.css", result.css); | |
| 73 | - | console.log("Tailwind CSS compiled to dist/styles.css"); | |
| 73 | + | console.log("Tailwind CSS compiled to /www/css/tailwind.css"); | |
| 74 | 74 | } catch (err) { | |
| 75 | 75 | console.error("Error building CSS:", err); | |
| 76 | 76 | } | |
mikemorris revised this gist 1 week ago. Go to revision
1 file changed, 1 insertion, 1 deletion
tailwindcss-compiler.js
| @@ -23,7 +23,7 @@ function log(message) { | |||
| 23 | 23 | // ==================================================================== | |
| 24 | 24 | // | | |
| 25 | 25 | // ==================================================================== | |
| 26 | - | function build() { | |
| 26 | + | async function build() { | |
| 27 | 27 | log('-----------------------'); | |
| 28 | 28 | ||
| 29 | 29 | const options = { | |
mikemorris revised this gist 1 week ago. Go to revision
1 file changed, 3 insertions, 2 deletions
tailwindcss-compiler.js
| @@ -2,8 +2,9 @@ import chokidar from 'chokidar'; | |||
| 2 | 2 | import fs from 'fs' | |
| 3 | 3 | import fse from 'fs-extra'; | |
| 4 | 4 | import fg from 'fast-glob'; | |
| 5 | - | import tailwindcss from '@tailwindcss/postcss' | |
| 6 | - | import autoprefixer from 'autoprefixer' | |
| 5 | + | import postcss from 'postcss'; | |
| 6 | + | import tailwindcss from '@tailwindcss/postcss'; | |
| 7 | + | import autoprefixer from 'autoprefixer'; | |
| 7 | 8 | ||
| 8 | 9 | // ==================================================================== | |
| 9 | 10 | // | | |