mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-01-08 19:45:08 +00:00
Only write the user themes file if the map has been changed. This fixes the issue where watcher being triple triggered on cold starts.
This commit is contained in:
parent
c88d30a4f4
commit
646b084a12
|
@ -96,14 +96,32 @@ const theming = plugin.withOptions((options) => ({
|
||||||
/* Generate the SASS map using the themes object */
|
/* Generate the SASS map using the themes object */
|
||||||
const sassMap = jsonToSassMap(JSON.stringify({'user-themes': themes}));
|
const sassMap = jsonToSassMap(JSON.stringify({'user-themes': themes}));
|
||||||
|
|
||||||
/* Write the SASS map to the file */
|
/* Get the file path */
|
||||||
fs.writeFile(path.resolve(__dirname, ('../../styles/user-themes.scss')), sassMap, (err) =>
|
const filename = path.resolve(__dirname, ('../../styles/user-themes.scss'));
|
||||||
|
|
||||||
|
/* Read the file and get its data */
|
||||||
|
let data;
|
||||||
|
try
|
||||||
{
|
{
|
||||||
if ( err )
|
data = fs.readFileSync(filename, {encoding: 'utf8'});
|
||||||
|
}
|
||||||
|
catch ( err )
|
||||||
|
{
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Write the file if the map has been changed */
|
||||||
|
if ( data !== sassMap )
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
return console.log(err);
|
fs.writeFileSync(filename, sassMap, {encoding: 'utf8'});
|
||||||
}
|
}
|
||||||
});
|
catch ( err )
|
||||||
|
{
|
||||||
|
console.error(err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterate through the user's themes and build Tailwind components containing
|
* Iterate through the user's themes and build Tailwind components containing
|
||||||
|
|
Loading…
Reference in New Issue
Block a user