1.0.1 • Published 2 years ago
metalsmith-ts v1.0.1
metalsmith-ts
A Metalsmith plugin for transpiling TypeScript files.
Install
yarn add -D metalsmith-ts
Usage
const metalsmith = require('metalsmith');
const markdown = require('@metalsmith/markdown');
const layouts = require('@metalsmith/layouts');
const typescript = require('metalsmith-ts');
metalsmith(__dirname)
.metadata({
sitename: 'My Site',
})
.source('src')
.destination('build')
.use(markdown())
.use(
typescript({
outputDir: 'js/',
})
)
.use(
layouts({
suppressNoFilesError: true,
})
)
.build((err) => {
if (err) throw err;
});
Options
outputDir (Optional)
The directory (relative to destination) where files will end up.
transpileOptions (Optional)
Object passed to TypeScript's transpileModule()
function. Click here for available options.
Notes
- Only files ending in
.ts
will be processed. - Files outside the source directory are ignored.