0

Looking for the right regular expression(s) to mirror the folder structure from "app" to the "dist" folder.

E.g. app/components/search/a.html app/components/search/b.html etc.

To: dist/components/search/a.html dist/components/search/b.html etc.

My current grunt htmlmin entry:

htmlmin: {
            dist: {
                options: {
                    collapseWhitespace: true,
                    collapseBooleanAttributes: true,
                    removeCommentsFromCDATA: true,
                    removeOptionalTags: true
                },
                files: {
                    '<%= yeoman.dist %>/components/search' : '<%= yeoman.app %>/components/search/**/*.html'
                }
            }
        },

Have tried several other combinations unsuccessfully.

binarygiant
  • 6,362
  • 10
  • 50
  • 73

1 Answers1

0

Turns out there is a pretty decent template for doing this in the Grunt file that Yeoman generate for Angular.

The yeoman generator directory style isn't quite what I wanted, so the default doesn't work. I've amended it to fit my needs.

My solution:

htmlmin: {
            dist: {
                options: {
                    collapseWhitespace: true,
                    collapseBooleanAttributes: true,
                    removeCommentsFromCDATA: true,
                    removeOptionalTags: true
                },
                files: [
                    {
                        expand: true,
                        cwd: '<%= yeoman.app %>/components',
                        src: '{,*/}*.html',
                        dest: '<%= yeoman.dist %>/components'
                    }
                ]
            }
        }
binarygiant
  • 6,362
  • 10
  • 50
  • 73