Skip to content

Commit

Permalink
option to ignore "Tailwind config not found" Error Message (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
Trapfether authored Jan 25, 2024
2 parents ddeeb0c + ebf74cc commit 772dd62
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@ Good example value: `valueMatch w-64 h-full bg-blue-400 relative`

<hr>

### `tailwind-raw-reorder.IgnoreConfigNotFound`:

Tailwind Raw Reorder will show an error message by default, `Tailwind Raw Reorder: Tailwind config not found` if `tailwind.config.*` is missing. This can be toggled on to hide and off to show the error message.

`"tailwind-raw-reorder.IgnoreConfigNotFound": true`

### `tailwind-raw-reorder.runOnSave`:

Tailwind Raw Reorder will run on save by default (if a `tailwind.config.*` file is present within your working directory). This can be toggled on or off.
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,12 @@
"description": "An object with language IDs as keys and their values determining the regex to search for Tailwind CSS classes.",
"scope": "window"
},
"tailwind-raw-reorder.IgnoreConfigNotFound": {
"type": "boolean",
"default": false,
"description": "A flag that controls whether or not to ignore 'Tailwind Raw Reorder: Tailwind config not found' Error Message.",
"scope":"window"
},
"tailwind-raw-reorder.runOnSave": {
"type": "boolean",
"default": true,
Expand Down
19 changes: 13 additions & 6 deletions src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ const config = workspace.getConfiguration();
/** @type {{ [key: string]: LangConfig | LangConfig[] }} */
const langConfig =
config.get('tailwind-raw-reorder.classRegex') || {};
/** @type {{ string: boolean } | undefined} */
const IgnoreConfigNotFound =
config.get('tailwind-raw-reorder.IgnoreConfigNotFound');

/**
* @param {ExtensionContext} context
Expand All @@ -41,9 +44,11 @@ export function activate(context) {
});

if (!tailwindConfig) {
window.showErrorMessage(
'Tailwind Raw Reorder: Tailwind config not found'
);
if (!IgnoreConfigNotFound) {
window.showErrorMessage(
'Tailwind Raw Reorder: Tailwind config not found'
);
}
return;
}

Expand Down Expand Up @@ -123,9 +128,11 @@ export function activate(context) {
});

if (!tailwindConfig) {
window.showErrorMessage(
'Tailwind Raw Reorder: Tailwind config not found'
);
if (!IgnoreConfigNotFound) {
window.showErrorMessage(
'Tailwind Raw Reorder: Tailwind config not found'
);
};
return;
}

Expand Down

0 comments on commit 772dd62

Please sign in to comment.