【问题标题】:Yeoman Grunt HTMLMin copy all files in subdirectories to same folder structure in distYeoman Grunt HTMLMin 将子目录中的所有文件复制到 dist 中的相同文件夹结构
【发布时间】:2014-06-19 17:34:34
【问题描述】:

寻找正确的正则表达式将文件夹结构从“app”镜像到“dist”文件夹。

例如应用程序/组件/搜索/a.html 应用程序/组件/搜索/b.html 等等

到:dist/components/search/a.html dist/components/search/b.html 等等

我当前的 grunt htmlmin 条目:

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

尝试了其他几种组合均未成功。

【问题讨论】:

    标签: gruntjs yeoman grunt-contrib-htmlmin


    【解决方案1】:

    事实证明,在 Yeoman 为 Angular 生成的 Grunt 文件中有一个相当不错的模板。

    yeoman 生成器目录样式不是我想要的,所以默认的不起作用。我已经对其进行了修改以满足我的需要。

    我的解决方案:

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-05-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多