1.0.2 • Published 1 year ago

dev-server-tailwindcss v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

Description

Providing Tailwind CSS support for @web/dev-server.

Install

npm i dev-server-tailwindcss -D

Usage

web-dev-server.config.js

import tailwindcssPlugin from 'dev-server-tailwindcss';

export default {
  ...
  plugins: [tailwindcssPlugin()],
};

postcss.config.js

Use the ES module for the configuration file and add "type": "module" in package.json.

Minimize CSS code after compiling tailwindcss.

import tailwindcss from 'tailwindcss';
import cssnano from 'cssnano';

export default {
  plugins: [
    tailwindcss,
    cssnano({ preset: ['default', { discardComments: { removeAll: true } }] })
  ],
};

Dev and Prod

import tailwindcss from 'tailwindcss';
import cssnano from 'cssnano';

const isDevelopment = process.argv.some(arg => /--watch|-w|dev-server/.test(arg));

const plugins = isDevelopment
  ? [tailwindcss]
  : [tailwindcss, cssnano({ preset: ['default', { discardComments: { removeAll: true } }] })];

export default {
  plugins,
};
1.0.2

1 year ago

1.0.1

1 year ago