andrejewski / smithsonian

web interface for Metalsmith
ISC License
36 stars 1 forks source link

How to use .source() and build() with smithsonian? #6

Closed abhijeetvramgir closed 8 years ago

abhijeetvramgir commented 8 years ago

I know this issue was raised before. But When I run this:

Smithsonian(__dirname)
    .source('./src')
    .destination('./build')
    .use(markdown())
    .use(layouts({
        engine: 'handlebars',
        directory: 'templates',
        partials: 'templates/partials'
    }))
    .build(function (err) {
        // For error handling
        if (err) {
            throw err;
        }
    }).listen(3000);

I get this:

TypeError: Smithsonian(...).source is not a function

I know you answered this before but I didnt understand. Thanks alot!

andrejewski commented 8 years ago

The ./src and ./build are the defaults so you don't have to specify those if those are your values. Otherwise, do this:

const server = Smithsonian(__dirname);

server.metalsmith
  .source('./src')
  .destination('./build');

server
    .use(markdown())
    .use(layouts({
        engine: 'handlebars',
        directory: 'templates',
        partials: 'templates/partials'
    }))
    .build(function (err) {
        // For error handling
        if (err) {
            throw err;
        }
    }).listen(3000);
abhijeetvramgir commented 8 years ago

Thanks for helping out!

On Sep 6, 2016 11:02 PM, "Chris Andrejewski" notifications@github.com wrote:

The ./src and ./build are the defaults so you don't have to specify those if those are your values. Otherwise, do this:

const server = Smithsonian(__dirname); server.metalsmith .source('./src') .destination('./build');

server .use(markdown()) .use(layouts({ engine: 'handlebars', directory: 'templates', partials: 'templates/partials' })) .build(function (err) { // For error handling if (err) { throw err; } }).listen(3000);

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/andrejewski/smithsonian/issues/6#issuecomment-245026916, or mute the thread https://github.com/notifications/unsubscribe-auth/AUNVwc5is3HJyk-n1GiFmZGwAcuyho_Qks5qnaOlgaJpZM4J2Epr .