rbtech / css-purge

A CSS tool written in Node JS as a command line app or library for the purging, burning, reducing, shortening, compressing, cleaning, trimming and formatting of duplicate, extra, excess or bloated CSS.
http://rbtech.github.io/css-purge
MIT License
125 stars 19 forks source link

I analize all files in folder and minimize all to same folder #15

Closed leandroluk closed 6 years ago

leandroluk commented 6 years ago

Hello, first of all I'm sorry for my English, I'm getting help from Google Translate.

I'm using your library to clean up my CSS and reduce the files and would like to know if there's any way I can get all the files in a directory and minimize them to the same directory but with the postfix '.min.css'.

Today I have the script in my package.json file so:

{
    ...
    "scripts": {
        "build:css:prod":"css-purge -i css/index.js -o css/index.min.js"
    ...
    }
}

But I have other files in the directory ... I even tried to use regular expressions, or setting the directory to the input and also to the output but the library does not work.

Is there any way (using your library) to compile all the files in the directory to the same name? (as in the example below):

before:

css/
 |- App.css
 |- Foo.css
 |- Bar.css

after:

css/
 |- App.css
 |- App.min.css // minified
 |- Foo.css
 |- Foo.min.css // minified
 |- Bar.css
 |- Bar.min.css // minified
AndrewEQ commented 6 years ago

Hi @leandroluk,

CSS-Purge as a standalone tool/library has been designed to merge 1 to many inputs into a single output (See Overview: http://rbtech.github.io/css-purge).

To repeat the process, you should use an automated build process...

Here's my example using gulp and the gulp-css-purge plugin to get your desired output: https://github.com/rbtech/gulp-css-purge-example

For grunt users: https://github.com/dominikwilkowski/grunt-css-purge