crafty is the core package of Crafty, it gives the foundations to load presets and execute the tasks and commands created by them.
Crafty comes with three default commands, reads one configuration file and loads presets. All the rest is handled by presets.
Crafty’s philosophy is that there are great build and automation tools out there, we don’t want to reinvent them.
Gulp is awesome to create tasks and streams of work, Webpack is great at creating bundles, PostCSS and its plugin ecosystem is big. But what plugins and loaders should we use for our needs ?
Crafty’s philosophy is that if you wish to use Gulp and Webpack together, it should be easy. If you want to use TypeScript instead of Babel, it should be a single configuration line change.
The default configuration should allow you to get started in a couple of minutes, but you should be able to fine-tune the configuration to your needs.
Another aspect is that configuring your build process once is one thing, keeping it up-to-date is more complicated. Does a new major version of PostCSS work with my existing plugins ? Does this minor update introduce a breaking change by mistake ? Crafty takes care of that heavy lifting and helps you keep your
In Crafty, a bundle is a piece of configuration that represents one or more source files and one destination file. (In some cases, more than one destination file.)
Each bundle has to be treated by a runner.
A runner’s purpose is to take a bundle and turn it into a task that will then take your files and compile them.
Each runner can be augmented with presets.
Presets are a way to extend Crafty’s capabilities with new tasks, commands, runners and configuration.
Each preset can use any number of extension points (functions) that will be executed by crafty or other presets.
We have an extension point that can override the configuration, an extension point to add Babel plugins (provided by the Babel preset) and more.
Read more about the anatomy of a preset
Existing runners and presets
crafty-runner-webpackUse this runner to bundle your code with Webpack.
crafty-runner-gulpUse this runner to be able to create Gulp tasks in your projects.
crafty-preset-babelEcmaScript 2015+ support with Babel and ESLint with our linting rules.
crafty-preset-postcssCompile your CSS using PostCSS, works with Webpack and Gulp.
crafty-preset-typescriptThis preset provides TypeScript support and configures ESLint with our linting rules.
crafty-preset-imagesThis preset compresses your SVG/PNG/JPG/GIF files.
crafty-preset-images-simpleIf you are behind a corporate proxy, this preset will copy images without compressing them.
crafty-preset-mavenThis preset overrides the destination to move your compiled assets to the right directory in
targetof your Maven project.
crafty-preset-reactA preset that provides default configuration when using React in a project. JSX Compilation is handled by the
crafty-preset-babelalready (Not Ready)
crafty-preset-jestThis preset will add Jest to the
crafty testcommand, works with Babel and TypeScript.