Coder Social home page Coder Social logo

gulp-metalsmith's People

Contributors

dominicscimeca avatar jelz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

gulp-metalsmith's Issues

Error: File.contents can only be a Buffer, a Stream, or null.

I am in the process of converting an existing Metalsmith site to be built with gulp-metalsmith, but am running into the File.contents error. From the trace I am given, it seems to be coming from the pushToStream method in /lib/index.js.

Error: File.contents can only be a Buffer, a Stream, or null.
    at File.set (/my_project/node_modules/vinyl/index.js:148:13)
    at baseAssignValue (/my_project/node_modules/lodash/lodash.js:2580:21)
    at assignValue (/my_project/node_modules/lodash/lodash.js:2496:9)
    at copyObject (/my_project/node_modules/lodash/lodash.js:4819:11)
    at /my_project/node_modules/lodash/lodash.js:12653:7
    at Function.<anonymous> (/my_project/node_modules/lodash/lodash.js:4892:13)
    at apply (/my_project/node_modules/lodash/lodash.js:496:27)
    at Function.<anonymous> (/my_project/node_modules/lodash/lodash.js:6600:16)
    at /my_project/node_modules/gulp-metalsmith/lib/index.js:91:16
    at /my_project/node_modules/lodash/lodash.js:4944:15
    at baseForOwn (/my_project/node_modules/lodash/lodash.js:3001:24)
    at Function.forOwn (/my_project/node_modules/lodash/lodash.js:13002:24)
    at pushToStream (/my_project/node_modules/gulp-metalsmith/lib/index.js:87:7)
    at /my_project/node_modules/gulp-metalsmith/lib/index.js:79:9
    at next (/my_project/node_modules/ware/lib/index.js:82:27)
    at /my_project/node_modules/wrap-fn/index.js:121:18

I have modified the file locally to resolve the issue as follows:

function pushToStream(transformed) {
  _.forOwn(transformed, function (value, key) {
    var file = value._vinyl || new gutil.File({stat: value.stat});
    file.path = path.join(file.base, key);
    s.push(_.extend(file, {contents: typeof value.contents === 'string' ? new Buffer(value.contents) : value.contents}));
    // Original Code: s.push(_.extend(file, {contents: value.contents}));
  });
}

While this solves the issue, I am not sure I have a strong argument that this is a bug in the plugin as it seems no one else has reported similar issues. My current build works fine with the same set of Metalsmith plugins generating the same files without error.

Is this something you would me to create a PR for? If not, do you have any thoughts as to what may be going wrong?

AssertionError: You must pass a working directory path.

I have a local installation of npm and gulp under ./metalsmith/security/

My striped gulpfile.jslooks like this:

var metalsmith = require('metalsmith'); //also tried require('..'); -> same output
var gulp = require('gulp');
var glob = require('glob');
var path = require('path');

gulp.task('default', function() {
    return gulp.src('../../sourceRepo')
        .pipe(metalsmith())
        .pipe(gulp.dest('../../build'));
});

This throws an AssertionError: You must pass a working directory path. error.

Apparently `require('metasmith') is wrong. What should I add there?

EDIT:
I had a typo in the first line: var Metalsmith -> var metalsmith
This throws "AssertionError: You must pass a working directory path."

Image data somehow affected by piping to gulp-metalsmith

First of all, thanks for the great tool. It has been a tremendous help and enables some truly graceful workflows.

I ran into an issue where my images were not being copied over to the build directory correctly; I narrowed the pipeline issue down to gulp-metalsmith.

Without knowing any specifics, I can say that both my .ico and .png files are somehow corrupted. Although copied over, no image viewer is able to display them, including the browser.

For now, I use gulp-filter to modify and restore the vinyl pipe before and after the gulp-metalsmith step, but it would be nice if I could avoid that additional step.

Thank you for your time.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.