Skip to content

Commit

Permalink
Determine the path to the tailwind config file.
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdnbrk committed May 25, 2019
1 parent 3f433cd commit d111d3e
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,36 @@
const mix = require('laravel-mix');

class Tailwind {
seesTailwindConfig(path) {
try {
require.resolve(path);

return true;
} catch (e) {
return false;
}
}

dependencies() {
this.requiresReload = `Tailwind CSS has now been installed.`;

return ['tailwindcss'];
}

register(configPath = './tailwind.js') {
register(configPath) {
this.configPath = configPath;

if (this.configPath !== undefined) {
return;
}

if (this.seesTailwindConfig('./tailwind.js')) {
this.configPath = './tailwind.js';
}

if (this.seesTailwindConfig('./tailwind.config.js')) {
this.configPath = './tailwind.config.js';
}
}

boot() {
Expand Down

0 comments on commit d111d3e

Please sign in to comment.