编辑:已解决,请参阅下文。

无法在基于Assemble.io的网站上使用“漂亮的URL”。用assemble-middleware-permalinks注释掉,它可以将页面很好地组装到我指定的文件夹中(如index.html,about.html等)。

完整的控制台输出:

# grunt

Running "clean:build" (clean) task
Cleaning ./dist...OK

Running "copy:assets" (copy) task
Created 2 directories, copied 13 files

Running "uglify:vendor" (uglify) task
File ./dist/development/assets/js/components.js created: 129.64 kB → 128.88 kB

Running "sass:dist" (sass) task
File dist/development/assets/css/main.css created.

Running "assemble:pages" (assemble) task

#


我的组装任务:

assemble: {

  options: {
    flatten: true,
    plugins: [
      'assemble-contrib-permalinks',
      'assemble-middleware-sitemap'
    ],

    permalinks: {
      structure: ':basename/index.html'
    },

    // Templates
    layoutdir: opt.layouts,
    partials: opt.layouts + '/partials/*.hbs',
    layout: 'default.hbs',

    // data: opt.data + '/*.{json,yml}',
    // assets: opt.dev + '/assets',

    sitemap: {
      homepage: opt.homepage,
      changefreq: 'monthly',
      priority: '0.8',
      robot: false,
      relativedest: true
    },

  },

  pages: {
    files: [
      {
        src: opt.pages + '/*.{hbs,md}',
        dest: opt.dev + '/'
      },
    ]
  }
}

最佳答案

终于,我开始工作了:

问题在于,v0.4.0和更高版本的assemble-middlewear-permalinks需要Assmble v0.5.0,但尚未准备好公开使用(请参阅:https://github.com/assemble/assemble-middleware-permalinkshttps://github.com/assemble/grunt-assemble)。

解决方法是安装assemble-contrib-permalinks(v0.3.6)并改用它。我还为可能遇到此问题的其他人更新了汇编任务代码。

关于javascript - Assemble.io assemble-middleware-permalinks不起作用,没有用于组装任务的输出,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/24525452/

10-11 14:42