Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTMLmin - How to dynamically compress all files inside a certain folder

I want to minify all HTML pages and maintain the page's name and path on the dist folder. I want to loop through all folders.

The code below works fine but ONLY for the parent folder (which is this case app/views).

grunt.initConfig({
    htmlmin: {
        dev: {
            files: [{
                expand: true,
                cwd: 'app/views/**',
                src: '{,*/}*.html',
                dest: 'dist/views'
            }]
        }
    }
});

As you can notice, I tried the magic star at the path app/views/** and had no luck.

This is my folder structure:

app/views/
├── page1.html
├── blocks
│   └── block.html
├── page2.html
└── page3.html

In my case, every template gets minified, except the ones under app/views/blocks folder.

like image 569
Muhammad Reda Avatar asked Apr 06 '14 12:04

Muhammad Reda


1 Answers

cwd: 'app/views',
src: '**/*.html',
like image 156
przno Avatar answered Nov 01 '22 07:11

przno