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

Doesn't seem to play nice with gulp-metalsmith #36

Open
justinhelmer opened this issue Feb 6, 2016 · 2 comments
Open

Doesn't seem to play nice with gulp-metalsmith #36

justinhelmer opened this issue Feb 6, 2016 · 2 comments

Comments

@justinhelmer
Copy link

First, thanks for building a much-needed libSass wrapper for metalsmith.

Unfortunately, I am having an issue getting it set up.

I haven't had an opportunity to dig in, but gulp-metalsmith seems to work with every other plugin I have tried.

With metalsmith-sass, there is an error:

Message:
    Arguments to path.join must be strings
Stack:
TypeError: Arguments to path.join must be strings
    at Object.posix.join (path.js:488:13)
    at compileSass (/Users/justin/workspace/gh-release-manager/node_modules/metalsmith-sass/lib/index.js:121:33)
    at Ware.<anonymous> (/Users/justin/workspace/gh-release-manager/node_modules/wrap-fn/index.js:45:19)
    at next (/Users/justin/workspace/gh-release-manager/node_modules/ware/lib/index.js:85:20)
    at Ware.run (/Users/justin/workspace/gh-release-manager/node_modules/ware/lib/index.js:88:3)
    at Object.run (/Users/justin/workspace/gh-release-manager/node_modules/gulp-metalsmith/lib/metalsmith.js:25:36)

This appears to be the context (lib/index.js:111):

/**
 * Looks up different key names on `metalsmith` to support
 * old versions (< v1) of Metalsmith. At some point, I will remove
 * support for < v1 and remove the key lookups
 */
var directory = metalsmith.dir || metalsmith._directory,
    source = metalsmith._src || metalsmith._source,
    basePath = path.join(directory, source);

Both directory and source end up being null. Any help would be greatly appreciated.

@stevenschobert
Copy link
Owner

Oh strange, I haven't heard any other issues with it before.

Can you share a little bit of what your setup looks like?

@justinhelmer
Copy link
Author

Sure. I have a CLI and node interface that both end up programmatically triggering gulp build. That build task uses gulp-metalsmith to performs several operations. This code emulates a simplified version of the workflow:

gulp.task('build', build);
exec('gulp build');

function build() {
  gulp.src(['source/**', '!source/layouts/**', '!source/partials/**'])
        .pipe(plumber())
        .pipe(metalsmith({
          use: [
            markdown(),
            layouts({
              engine: 'handlebars',
              default: 'page.html',
              directory: 'source/layouts',
              partials: 'source/partials',
              pattern: '**/*.html'
            })
          ]
        }));

As you can see, ideally I can use your great tool inline with markdown() and layouts(), via gulp-metalsmith's use() property method.

Currently, I am using gulp-sass directly. This works great; however, I would ideally like to merge the operations.

Thanks a lot for your quick response.

EDIT: If interested, here is the precise implementation.

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