【问题标题】:how to build yeoman angular-fullstack without minification如何在不缩小的情况下构建 yeoman angular-fullstack
【发布时间】:2015-05-04 08:53:48
【问题描述】:

我想使用 Gruntfile 的构建任务,它是 yeoman angular-fullstack 项目的一部分。但是我希望 JS 代码仍然可读,并且还希望避免资产文件名被重命名。

到目前为止,我将 Gruntfile 更改为以下内容:

  1. 在 useminPrepare 中更改默认流行为

在 gruntfile 中:

useminPrepare: {
  html: ['<%= yeoman.client %>/index.html'],
  options: {
    dest: '<%= yeoman.dist %>/public',

    // default flow behavior : https://github.com/yeoman/grunt-usemin#flow
    // change the default flow behavior
    flow: {
      steps: {
        js: ['concat'],
        css: ['concat']
      },
      post: {}
    }


  }
}
  1. 不要执行 imagemin 或 svgmin

在 gruntfile 中:

    concurrent: {
      // ...
      dist: [
        'sass',
        // 'imagemin',
        // 'svgmin'
      ]
    },
  1. 更改构建任务

在 gruntfile 中:

grunt.registerTask('build', [
    'clean:dist',
    'injector:sass',
    'concurrent:dist',
    'injector',
    'wiredep',
    'useminPrepare',
    'autoprefixer',
    'ngtemplates',
    'concat',
    'ngAnnotate',
    'copy:dist',
    'cdnify',
    //'cssmin',
    //'uglify',
    // 'rev',
    'usemin'
  ]);

当我构建我的项目时,我看到了

  1. js 代码现在全部在 app.js 中,但可读性很好
  2. 资产/图片丢失
  3. html 部分缺失。只有 index.html 存在

谁能帮我为 dist 文件夹设置一个构建过程,该文件夹仍然具有正确的图像文件名和 html 和 js 代码仍然可读? 源文件可以放在一个大文件中,但仍应可读。

【问题讨论】:

    标签: javascript angularjs yeoman grunt-usemin angular-fullstack


    【解决方案1】:

    添加 imagemin 和 svgmin-tasks,它们只是尝试压缩您使用的图像,它们不会使您的代码不可读。

    【讨论】:

    • 谢谢你是对的,这不是我的解决方案的一部分。但这并没有解决其他问题
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-05
    • 2015-04-29
    • 1970-01-01
    • 1970-01-01
    • 2016-10-23
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多