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

docpad watch fails with documents with a layout (6.17.1) #368

Closed
DjebbZ opened this issue Dec 4, 2012 · 4 comments
Closed

docpad watch fails with documents with a layout (6.17.1) #368

DjebbZ opened this issue Dec 4, 2012 · 4 comments

Comments

@DjebbZ
Copy link

DjebbZ commented Dec 4, 2012

It may be related to #366

When I generate a document normally with docpad generate, everything works fine. But when I use docpad watch, It's not working. Below is output of docpad watch --debug where there's an error saying that the layout couldn't be found.

I'm writing content in markdown and use eco for the layout. So I have src/documents/index.html.md with metadata layout: default, and src/layouts/default.html.eco.

Here are the debug output :

docpad watch --debug
debug: Plugins loading for: /path/to/site/node_modules
    → [2012-12-04 14:28:46.712] [/path/to/docpad.js:1370] [DocPad.log]
debug: Loading plugin: .bin
    → [2012-12-04 14:28:46.718] [/path/to/docpad.js:1370] [DocPad.log]
debug: Loading plugin: docpad
    → [2012-12-04 14:28:46.720] [/path/to/docpad.js:1370] [DocPad.log]
debug: Loading plugin: eco
    → [2012-12-04 14:28:46.722] [/path/to/docpad.js:1370] [DocPad.log]
debug: Loading plugin: less
    → [2012-12-04 14:28:46.724] [/path/to/docpad.js:1370] [DocPad.log]
debug: Loading plugin: marked
    → [2012-12-04 14:28:46.725] [/path/to/docpad.js:1370] [DocPad.log]
debug: Skipped the unsupported plugin: docpad due to type
    → [2012-12-04 14:28:46.730] [/path/to/docpad.js:1370] [DocPad.log]
debug: Loaded plugin: less
    → [2012-12-04 14:28:46.734] [/path/to/docpad.js:1370] [DocPad.log]
debug: Loaded plugin: eco
    → [2012-12-04 14:28:46.737] [/path/to/docpad.js:1370] [DocPad.log]
debug: Loaded plugin: marked
    → [2012-12-04 14:28:46.740] [/path/to/docpad.js:1370] [DocPad.log]
debug: Plugins loaded for: /path/to/site/node_modules
    → [2012-12-04 14:28:46.741] [/path/to/docpad.js:1370] [DocPad.log]
debug: Performed the action load
    → [2012-12-04 14:28:46.745] [/path/to/docpad.js:1370] [DocPad.log]
debug: Performing the action ready
    → [2012-12-04 14:28:46.746] [/path/to/docpad.js:1370] [DocPad.log]
info: Welcome to DocPad v6.17.1
    → [2012-12-04 14:28:46.774] [/path/to/docpad.js:1370] [DocPad.log]
info: Plugins: eco v2.0.1, less v2.1.1, marked v2.1.0
    → [2012-12-04 14:28:46.777] [/path/to/docpad.js:1370] [DocPad.log]
info: Environment: development
    → [2012-12-04 14:28:46.778] [/path/to/docpad.js:1370] [DocPad.log]
debug: Performed the action ready
    → [2012-12-04 14:28:46.783] [/path/to/docpad.js:1370] [DocPad.log]
debug: Performing the action watch
    → [2012-12-04 14:28:46.785] [/path/to/docpad.js:1370] [DocPad.log]
info: Watching setup starting...
    → [2012-12-04 14:28:46.814] [/path/to/docpad.js:1370] [DocPad.log]
info: Watching setup
    → [2012-12-04 14:28:46.884] [/path/to/docpad.js:1370] [DocPad.log]
debug: Performed the action watch
    → [2012-12-04 14:28:46.887] [/path/to/docpad.js:1370] [DocPad.log]
info: The action completed successfully
    → [2012-12-04 14:28:46.888] [/path/to/docpad.js:1370] [DocPad.log]

This is when I change the index.html.md file :

debug: Change detected at 14:28:56 change /path/to/site/src/documents/index.html.md
    → [2012-12-04 14:28:56.271] [/path/to/docpad.js:1370] [DocPad.log]
debug: Adding document: /path/to/site/src/documents/index.html.md
    → [2012-12-04 14:28:56.274] [/path/to/docpad.js:1370] [DocPad.log]
info: Regenerating at 14:28:56
    → [2012-12-04 14:28:56.378] [/path/to/docpad.js:1370] [DocPad.log]
debug: Performing the action generate
    → [2012-12-04 14:28:56.379] [/path/to/docpad.js:1370] [DocPad.log]
info: Generating...
    → [2012-12-04 14:28:56.382] [/path/to/docpad.js:1370] [DocPad.log]
debug: Loading 1 files
    → [2012-12-04 14:28:56.397] [/path/to/docpad.js:1370] [DocPad.log]
debug: Loading file: index.html.md
    → [2012-12-04 14:28:56.398] [/path/to/docpad.js:1370] [DocPad.log]
debug: Loading the file: undefined
    → [2012-12-04 14:28:56.400] [/path/to/docpad.js:1370] [DocPad.log]
debug: Loaded the file: /path/to/site/src/documents/index.html.md
    → [2012-12-04 14:28:56.403] [/path/to/docpad.js:1370] [DocPad.log]
debug: Adding html file: /path/to/site/src/documents/index.html.md
    → [2012-12-04 14:28:56.427] [/path/to/docpad.js:1370] [DocPad.log]
debug: Loaded file: index.html.md
    → [2012-12-04 14:28:56.429] [/path/to/docpad.js:1370] [DocPad.log]
debug: Loaded 1 files
    → [2012-12-04 14:28:56.430] [/path/to/docpad.js:1370] [DocPad.log]
debug: Contextualizing 1 files
    → [2012-12-04 14:28:56.433] [/path/to/docpad.js:1370] [DocPad.log]
debug: Performed the action generate
    → [2012-12-04 14:28:56.439] [/path/to/docpad.js:1370] [DocPad.log]
error: An error occured: 
Error: Could not find the specified layout: default
    at DocumentModel.getLayout (/path/to/models/document.js:269:17)
    at DocumentModel.DocPad.createDocument.document.on.args (/path/to/docpad.js:1528:14)
    at DocumentModel.Backbone.Events.trigger (/Users/khalid_jebbari/.nvm/v0.8.11/lib/node_modules/docpad/node_modules/query-engine/node_modules/backbone/backbone.js:163:27)
    at DocumentModel.emit (/path/to/base.js:24:23)
    at DocumentModel.getLayout (/path/to/models/document.js:261:12)
    at DocumentModel.getEve (/path/to/models/document.js:285:12)
    at DocumentModel.contextualize (/path/to/models/document.js:190:20)
    at DocumentModel.FileModel.contextualize (/path/to/models/file.js:444:5)
    at DocumentModel.contextualize (/path/to/models/document.js:189:43)
    at DocPad.contextualizeFiles.docpad.emitSync.collection (/path/to/docpad.js:2022:21)
    → [2012-12-04 14:28:56.442] [/path/to/docpad.js:1370] [DocPad.log]
info: Regenerated at 14:28:56
    → [2012-12-04 14:28:56.449] [/path/to/docpad.js:1370] [DocPad.log]
@balupton
Copy link
Member

balupton commented Dec 4, 2012

We should have watch perform a generate beforehand. As what has happened here is because we haven't parsed everything and rendered things, then when we do a watch regeneration, it doesn't have access to everything it needs.

@balupton
Copy link
Member

balupton commented Dec 4, 2012

For the meantime just use docpad run

balupton added a commit that referenced this issue Dec 4, 2012
- v6.17.2 December 5, 2012
	- `watch` and `server` actions now perform an initial generation
		- Thanks [Khalid Jebbari](https://github.com/DjebbZ), [Vladislav
Botvin](https://github.com/darrrk)
		- Closes [#369](#369),
[#368](#368),
[#366](#366)
@balupton
Copy link
Member

balupton commented Dec 4, 2012

Fixed in v6.17.2 which has docpad watch perform an initial generation

@balupton balupton closed this as completed Dec 4, 2012
@DjebbZ
Copy link
Author

DjebbZ commented Dec 5, 2012

Fix confirmed, thanks !

balupton added a commit that referenced this issue Oct 23, 2013
- v6.17.2 December 5, 2012
	- `watch` and `server` actions now perform an initial generation
		- Thanks [Khalid Jebbari](https://github.com/DjebbZ), [Vladislav
Botvin](https://github.com/darrrk)
		- Closes [#369](#369),
[#368](#368),
[#366](#366)
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

2 participants