-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
20d2498
commit caeb97a
Showing
7 changed files
with
93 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
.s-whmcs { | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
const postcss = require('postcss'); | ||
const postcssImport = require('postcss-import'); | ||
const postcssNested = require('postcss-nested'); | ||
const tailwindcss = require('tailwindcss'); | ||
const autoprefixer = require('autoprefixer'); | ||
const cssnano = require('cssnano'); | ||
const fs = require('fs'); | ||
const chokidar = require('chokidar'); | ||
|
||
const inputFile = './assets/css/style.css'; | ||
const outputFile = './assets/css/style.min.css'; | ||
const templatesFolder = './templates'; // Update with your templates folder path | ||
|
||
const plugins = [ | ||
postcssImport, | ||
postcssNested, | ||
tailwindcss, | ||
autoprefixer, | ||
cssnano | ||
]; | ||
|
||
const processCSS = async () => { | ||
try { | ||
const css = fs.readFileSync(inputFile, 'utf8'); | ||
|
||
const result = await postcss(plugins).process(css, { | ||
from: inputFile, | ||
to: outputFile, | ||
map: { inline: false }, | ||
}); | ||
|
||
fs.writeFileSync(outputFile, result.css); | ||
|
||
console.log('CSS build completed successfully.'); | ||
} catch (error) { | ||
console.error('Error building CSS:', error); | ||
} | ||
}; | ||
|
||
// Function to watch for CSS file changes | ||
const watchCSS = () => { | ||
console.log('Watching for CSS file changes...'); | ||
chokidar.watch(inputFile).on('change', () => { | ||
console.log('CSS file changed. Rebuilding...'); | ||
processCSS(); | ||
}); | ||
}; | ||
|
||
// Function to watch for template file changes | ||
const watchTemplates = () => { | ||
console.log('Watching for template file changes...'); | ||
chokidar.watch(templatesFolder).on('change', () => { | ||
console.log('Template file changed. Rebuilding CSS...'); | ||
processCSS(); | ||
}); | ||
}; | ||
|
||
// Start the initial CSS build | ||
processCSS(); | ||
|
||
// Start watching for changes in watch mode | ||
if (process.argv.includes('--watch')) { | ||
watchCSS(); | ||
watchTemplates(); // Add this line to watch templates folder | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module.exports = { | ||
plugins: { | ||
'postcss-import': {}, | ||
'postcss-nested': {}, | ||
'tailwindcss': {}, | ||
'autoprefixer': {}, | ||
'cssnano': {} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters