Search code examples
javascriptgruntjspermalinksassemble

Assemble.io assemble-middleware-permalinks not working, no output for assemble task


EDIT: Solved, see below.

Having trouble getting 'pretty URLs' to work with Assemble.io based site. With assemble-middleware-permalinks commented out it assembles the pages just fine into my specified folder (as index.html, about.html etc).

Full console output:

# 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

# 

My 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 + '/'
      },
    ]
  }
}

Solution

  • Finally I've got it working:

    The problem was that the v0.4.0 and greater of assemble-middlewear-permalinks requires Assmble v0.5.0 which is not yet ready for public use (see: https://github.com/assemble/assemble-middleware-permalinks and https://github.com/assemble/grunt-assemble).

    The fix was to install assemble-contrib-permalinks (v0.3.6) and use this instead. I've also updated the assemble task code for others who might come across this issue.