gulp.task('content', function () { console.log('... building content ...'); // TODO : could just source content here return gulp.src(['./src/**', '!./src/io/**']) //.pipe(f) .pipe(metalsmith({ // set Metalsmith's root directory, for example for locating templates, defaults to CWD root: __dirname, // files to exclude from the build ignore: [], // read frontmatter, defaults to true frontmatter: true, // Metalsmith plugins to use use: [ //lens(), metadata({ site: 'meta.json', settings: 'settings.json' }), date({key: 'dateBuilt'}), //gulpIgnore.include(condition), markdown(), collections({ articles: { pattern: './content/articles/*.md', sortBy: 'date', reverse: 'True' } , news: { pattern: './content/news/*.md', sortBy: 'date', reverse: 'True' } , books: { pattern: './content/books/*.md', sortBy: 'date', reverse: 'True' } }), permalinks({ pattern: ':collections:title' }), feed({collection: 'articles'}), layouts({ engine: 'jade', moment: moment }), beautify() ], // Initial Metalsmith metadata: metadata: { site_title: 'Sample static site' } })) .pipe(gulp.dest(__.pub)); });
gulp.task('f', function () { const f = filter(['*', '!src/content']); return gulp .src(__.sass_src) .pipe(f) .pipe(metalsmith({ // set Metalsmith's root directory, for example for locating templates, defaults to CWD root: __dirname, // files to exclude from the build ignore: [ __.build_src + '/*.tmp', 'io/*' ], // read frontmatter, defaults to true frontmatter: true, // Metalsmith plugins to use use: [ metadata({ site: 'meta.json', settings: 'settings.json' }), //gulpIgnore.include(condition), markdown(), collections({ articles: { pattern: './content/articles/*.md', sortBy: 'date', reverse: 'True' } , news: { pattern: './content/news/*.md', sortBy: 'date', reverse: 'True' } , books: { pattern: './content/books/*.md', sortBy: 'date', reverse: 'True' } }), permalinks({ pattern: ':collections:title' }), feed({collection: 'articles'}), layouts({ engine: 'jade', moment: moment }), beautify() ], // Initial Metalsmith metadata: metadata: { site_title: 'Sample static site' } })) .resume(); });
exports.html = cb => new Metalsmith(__dirname) // basic options .clean(false) .source(SOURCE_PATH) .destination(OUTPUT_PATH) // plugins .use(plugins.removeFiles({ target: OUTPUT_PATH, extensions: CLEANUP_EXTENSIONS })) .use(plugins.metadata({ destination: OUTPUT_PATH, tocData: require('./data/toc.json') })) .use(markdown({ gfm: true, renderer: markedFactory(), smartypants: false, tables: true })) .use(plugins.configureSwig(swigViews, swigOptions)) .use(headings({ // use a single jQuery selector so we get all the headings in order selectors: [TOC_HEADINGS.join(', ')] })) .use(plugins.buildHeadingTree()) .use(plugins.addTemplateName()) .use(plugins.addJsdocTagMetadata()) .use(plugins.adjustMetadata()) .use(plugins.swig(swigOptions)) .use(plugins.buildRedirects(require('./data/redirects.json'))) .use(plugins.copyStaticFile({ source: path.join(require.resolve('code-prettify'), '..', '..', 'loader', 'prettify.js'), destination: path.join(__dirname, 'scripts', 'prettify.js') })) /* eslint-disable camelcase */ .use(beautify({ css: false, html: { indent_char: ' ', indent_size: 2, // js-beautify ignores the value 0 because it's falsy max_preserve_newlines: 0.1 }, js: false })) // go! .build(cb);
/** * Helper. * * Invoke Metalsmith. */ function metalsmith(options, done) { Metalsmith(root) .destination(options.destination || 'build') .use(metadata({ meta: options.meta || 'meta.yaml' })) .use(sass({ outputStyle: 'compressed', includePaths: eggshell.includePaths, outputDir: 'assets/css' })) .use(collections(docs)) .use(collectionMeta) .use(markdown({ gfm: true, highlight: function(code, lang) { if (lang) return highlight.highlight(lang, code).value; return highlight.highlightAuto(code).value; } })) .use(permalinks({ pattern: ':collection/:title' })) .use(buildId) .use(promote) .use(templates('jade')) .use(ignore([ '**/_*', '*.yaml' ])) .use(beautify({ js: false, css: false })) // .use(_debug) .build(done); }
var ignore = require('metalsmith-ignore'); Metalsmith(__dirname) .use(jade({ pretty:false })) .use(markdown()) .use(rootpath()) //.use(layouts({ engine: 'handlebars' })) .use(sass({ outputDir: 'css/' })) .destination('./dist') .use(serve({ port: 3000, verbose: true })) .use(watch({ paths: { "${source}/**/*": "**/*.{md,jade,sass}" }, livereload: true })) .use(layouts({ engine: 'jade' })) .use(beautify({ indent_size: 2, indent_char: ' ', js: false })) .build(function (err) { if(err) console.log(err) })
}), // Style using sass sass({ outputDir: 'style/' }), // Autoprefix styles autoprefixer({ // Support browsers based on these versions browsers: ['last 2 versions', '> 5%'] }), // Prettify output beautify({ indent_size: 2, indent_char: ' ', wrap_line_length: 0, end_with_newline: true, css: true, html: true }), // Ignore some files ignore([ '**/*.scss' ]) ], deploy: [ s3({ action: 'write', bucket: 'test-prismic-ellyo', region: 'us-west-2' }) ]
"avoimet-tyopaikat/**.html" ], default: "fi.pug" })) .use(metalsmith_layouts({ engine: "pug", directory: "templates", pattern: [ "sv/**/**.html" ], default: "sv.pug" })) .use(metalsmith_beautify({ js: true, css: true, html: { wrap_line_length: 80 } })) .use(metalsmith_clean_css({ files: "src/styles/*.css", cleanCSS: { rebase: true } })) .use(metalsmith_excerpts()) .use(metalsmith_collections({ advertisements: { pattern: 'avoimet-tyopaikat/**.html', sortBy: 'date', reverse: true