Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails: (Unexpected token <) #39

Closed
caraya opened this issue Feb 10, 2016 · 3 comments
Closed

Build fails: (Unexpected token <) #39

caraya opened this issue Feb 10, 2016 · 3 comments

Comments

@caraya
Copy link

caraya commented Feb 10, 2016

I'm getting different errors when trying to build a site using grunt-assemble 0.4.0

When I run grunt --foce --verbose I get the following errors:

Building pages...
Warning: Source files not found. Used --force, continuing.
Information compiled

. . .

Assembling pages...
>> 0 pages assembled.

Step 17 assembled.
Calling step 18

Step 18 assembled.
Build completed. Returning

Done, but with warnings.

but when I just run grunt with a default target of assemble I get:

[18:13:40] carlos@rivendell new-site 1478$ grunt
Running "assemble:layout" (assemble) task
Warning: Unable to parse "./templates/layouts/default-layout.hbs" file (Unexpected token <). Use --force to continue.

Aborted due to warnings.

Why am I getting different errors? I would expect that if grunt-assemble cannot find the source files it'll tell me before failing to build the pages.

What does the unexpected token warning mean? Is this a grunt-assemble issue or a handlebars one?
I'm inclined to think it's a grunt-assemble issue because I've tried to build content from the templates using http://tryhandlebarsjs.com/ and it build successfully.

Just in case it helps, here is the dev-dependencies from my package.json:

  "devDependencies": {
    "assemble-core": "^0.11.2",
    "babel": "^6.5.1",
    "grunt": "^0.4.5",
    "grunt-assemble": "^0.4.0",
    "grunt-autoprefixer": "^3.0.3",
    "grunt-contrib-clean": "^0.7.0",
    "grunt-contrib-copy": "^0.8.2",
    "grunt-contrib-jshint": "^0.12.0",
    "grunt-contrib-sass": "^0.9.2",
    "grunt-jscs": "^2.7.0",
    "grunt-scss-lint": "^0.3.8",
    "jshint-stylish": "^2.1.0",
    "load-grunt-tasks": "^3.4.0",
    "time-grunt": "^1.3.0"
  }

and the task from my Gruntfile (commented as I've been swapping things in and out to see if they work or not)

      assemble: {
        options: {
          marked: {
            breaks: false,
            gfm: true,
            highlight: function (lang, code) {
              return hljs.highlightAuto(lang, code).value;
            },
            sanitize: false,
            silent: false,
            smartLists: false,
            smartypants: false,
            tables: true
          }
        },
//        assets: 'assets/',
//        data:   'data/',
        layout: 'templates/layouts/default-layout.hbs',
        partials: 'templates/layouts/partials/**/*.hbs'
      },
      projects: {
//        options: {
//          layout: 'templates/layout/project-layout.hbs',
//          partials: 'templates/layout/partials/**/*.hbs'
//        },
        files: {
          src: [ 'src/projects/*.md ' ],
          dest: [ 'dist/projects' ]//,
//          expand: true
        }
      },
      posts: {
//        options: {
//          layout: 'templates/layout/project-posts.hbs',
//          partials: 'templates/layout/partials/**/*.hbs'
//        },
        files: {
          src: [ 'src/posts/*.md ' ],
          dest: [ 'dist/posts' ]//,
//          expand: true
        }
      }
@assemblebot
Copy link

@caraya Thanks for the issue! If you're reporting a bug, please be sure to include:

  • The version of assemble you are using.
  • Your assemblefile.js (This can be in a gist)
  • The commandline output. (Screenshot or gist is fine)
  • What you expected to happen instead.

@doowb
Copy link
Member

doowb commented Feb 10, 2016

It looks like you have a typo in the configuration. The layout and partials properties should be inside the options block next to marked. I think there's an extra } someplace and grunt is trying to run it like a target... see in the output where it says assemble:layout... you should only see assemble:projects and assemble:posts.

@doowb
Copy link
Member

doowb commented Mar 18, 2017

Closing due to age and no response from OP. If you're still having an issue, please feel free to reopen with more details.

@doowb doowb closed this as completed Mar 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants