UNPKG

28.3 kBMarkdownView Raw
1<!-- STOP! Don't edit me. Look at local.gulpfile.js/README.md and build from there. -->
2
3<div align="center">
4
5<!-- Typedocs will have a copy of ./media in its own folder -->
6<img src="media/timpla-logo.png" width="182" height="100" />
7
8Your auntie's favourite asset bundler for [server-side] web frameworks. Provides an optimal web-development experience for TypeScript and/or ESNext.
9
10Powered by gulp 4 & webpack 4.
11
12[![Greenkeeper badge](https://badges.greenkeeper.io/igimanaloto/timpla.svg)](https://greenkeeper.io/)
13[![Build Status](https://travis-ci.org/igimanaloto/timpla.svg?branch=master)](https://travis-ci.org/igimanaloto/timpla)
14[![Coverage Status](https://coveralls.io/repos/github/igimanaloto/timpla/badge.svg)](https://coveralls.io/github/igimanaloto/timpla)
15[![npm version](https://badge.fury.io/js/timpla.svg)](https://badge.fury.io/js/timpla)
16
17</div>
18
19- [Getting started](#getting-started)
20 - [Installation](#installation)
21 - [The Timpla-way of thinking](#the-timpla-way-of-thinking)
22 - [Commands](#commands)
23 - [Debugging](#debugging)
24 - [Influence](#influence)
25- [Configuring Timpla](#configuring-timpla)
26 - [List of available options](#list-of-available-options)
27 - [The timplaHelper object](#the-timplahelper-object)
28 - [Specifying a config file on runtime](#specifying-a-config-file-on-runtime)
29 - [Overriding babel & babel-loader options](#overriding-babel---babel-loader-options)
30 - [Configuring Webpack](#configuring-webpack)
31 - [Overriding tasks](#overriding-tasks)
32 - [TypeScript](#typescript)
33 - [Disabling TypeScript / TSLint](#disabling-typescript---tslint)
34 - [ESLint](#eslint)
35 - [Disabling ESLint](#disabling-eslint)
36- [The three levels of reloading](#the-three-levels-of-reloading)
37 - [BrowserSync injection and reloading](#browsersync-injection-and-reloading)
38 - [Hot module reloading + React HMR](#hot-module-reloading---react-hmr)
39 - [Dev-server reloading based on config file changes](#dev-server-reloading-based-on-config-file-changes)
40- [Common setups](#common-setups)
41 - [Using Timpla as a static html workflow](#using-timpla-as-a-static-html-workflow)
42 - [Using Timpla with an existing site (Proxy option)](#using-timpla-with-an-existing-site--proxy-option-)
43 - [Replacing the html task with Shopify Liquid templating](#replacing-the-html-task-with-shopify-liquid-templating)
44- [Common Problems](#common-problems)
45 - [I'm getting a different version of dependency X when I use Timpla!](#i-m-getting-a-different-version-of-dependency-x-when-i-use-timpla-)
46 - [Timpla doesn't pick up changes to my eslintrc](#timpla-doesn-t-pick-up-changes-to-my-eslintrc)
47 - [When I build, javascript files don't work!](#when-i-build--javascript-files-don-t-work-)
48 - [process.cwd() isn't working as it's supposed to!](#processcwd---isn-t-working-as-it-s-supposed-to-)
49 - [Tips for working with npm linked dependencies](#tips-for-working-with-npm-linked-dependencies)
50- [CAQIAs (Commonly asked questions I ask)](#caqias--commonly-asked-questions-i-ask-)
51- [Developing the plugin](#developing-the-plugin)
52- [Releasing the plugin](#releasing-the-plugin)
53
54## Getting started
55
56Timpla aims is to provide you with an excellent web development experience. Timpla focuses on the truly defined parts in every build process: preparing javascript, css and media files for your websites. Three layers of reloading power Timpla: CSS-injection/reloading via BrowserSync (proxy or server), Webpack JS/TS Hot Module Reloading and full dev-server reloads based on core config changes.
57
58Unlike a `boilerplate` or a `full-blown` development framework, the rational behind Timpla is that of guiding users with an undiscriminating base. You bring your own dependencies to enhance and/or extend the core Timpla build pipeline.
59
60Timpla maintains its own side of the fence, while you focus on the more important aspects of your workflow, or better yet - getting straight into work!
61
62You may wonder why bother with Timpla if Webpack does everything. Timpla by no means undermines what Webpack is already able to achieve! However, in our quest to find a sweet development environment, we've come to realise that forcing everything through Webpack yields painful load and reload times. Timpla's performance and tooling in a decently sized project is something we're proud of!
63
64<!-- Typedocs will have a copy of ./media in its own folder -->
65<img src="media/timpla-sample.jpg" />
66
67### Installation
68
69We recommend that you install Timpla as a whole first first, and removing bits that you do not need. See [Configuring Timpla](#configuring-timpla) for more info.
70
71```sh
72# Base install
73npm i --save-dev timpla webpack @babel/core
74
75# Run these too to get Timpla up and running after npx timpla init.
76# The dependencies below are for extending Timpla to have both
77# TypeScript and Javascript running in parallel.
78# Each of the dependencies here are removeable, so we recommend
79# installing the whole bunch first to see how everything works.
80# Slim it down afterwards based on your requirements!
81npm i --save-dev react react-dom react-hot-loader prettier @babel/preset-env @babel/polyfill @babel/preset-typescript @babel/preset-react eslint eslint-loader babel-eslint eslint-config-prettier eslint-plugin-react tslint-config-prettier typescript tslint tslint-react @types/react @types/react-dom webpack-bundle-analyzer hard-source-webpack-plugin fork-ts-checker-webpack-plugin speed-measure-webpack-plugin
82
83# Initialise timpla
84# Careful: outputs config files and a starter src directory:
85# babel.config.js
86# .eslintrc
87# tsconfig.json
88# tslint.json
89# .prettierrc
90# .timplaconfig.js
91npx timpla init
92
93# Start the dev-server
94npx timpla
95
96# Build all asset files
97npx timpla build
98```
99
100### The Timpla-way of thinking
101
102Timpla is a process-driven tool. Each `asset stream` holds a pre-defined and parallelised part in the Timpla build chain. The following assets are built in parallel:
103
104- `Sass` files are compiled into css files, so you may load it as normal in your templates.
105- `SVG` files are combined into single-svgs for use, either via direct insertion into your templates, or your javascript-driven loading.
106- `Image` and `static` asset files are simply copied, but the processes are extendible, wherein you can tap into the build-stream and introduce your own pre-processing tasks.
107- `Javascript and/or Typescript` files bundled using Webpack.
108- Useful tooling such as file size reports, file-revving, bundle analysis and Webpack performance measurements are made available to further enhance your development process.
109
110In every dev or production build, `prebuild` and `postbuild` hooks are available for you to enhance the Timpla process. Apart from the javascript task, you may replace how each asset-type is processed via Timpla's alternateable tasking system.
111
112Timpla also allows you to register extra tasks via Gulp. These may be added to the pre or post parts of the build process.
113
114Timpla nukes the `destination` folder for every dev or production start. This ensures that you treat the `src` directory as the one true source for raw source files.
115
116### Commands
117
118```sh
119# Timpla starts the development server by default (npx timpla)
120npx timpla [command]
121
122[command]
123init # inits timpla (copies initial src and config files to project root)
124initConfig # recreates the .timplaconfig.js file in the project root
125build # outputs build files
126clean # cleans the dest directory
127javascripts # builds js and ts files
128rev # revs files and outputs a manifest file (designed for html/basic use-cases only)
129sizeReport # shows a file sizes report
130svg # combines svg files into one
131stylesheets # transpiles sass/scss files to css
132openAnalyzer # opens the bundle analyzer (run this after a build)
133fonts # copies files from font src to dest
134images # copies files from images src to dest
135staticFiles # copies files from static src to dest
136html # copies files from html src to dest
137```
138
139These will be available as `npx timpla [yourcustomtask]`.
140
141You can also set up npm scripts to simplify the commands:
142
143```json
144# You package.json file
145{
146 "scripts": {
147 "build": "timpla build",
148 "start": "timpla",
149 "tasks": "npx timpla --tasks"
150 }
151}
152```
153
154### Debugging
155
156Enable verbose logs by running any timpla command with env DEBUG=timpla:
157
158```sh
159DEBUG=timpla timpla [command]
160```
161
162To view a breakdown of plugin / loader times, you may also enable it by setting MEASURE=1:
163
164```sh
165MEASURE=1 timpla [command]
166```
167
168This is done through `speed-measure-webpack-plugin`, so you'll need to have that installed in your project. ForkTS Checker breaks when this is run along-side it, so we have decided not to make it separate from the rest of the debug process. Follow the [issue here](https://github.com/stephencookdev/speed-measure-webpack-plugin/issues/56).
169
170### Influence
171
172Server-side frameworks like Django, Rails, Craft, Wordpress and Laravel come with templating engines that require access to static assets.
173
174Timpla brings back the ol' 'just-output-built-files' approach to asset bundling.
175
176This plugin provides a drop-in asset bundling system to complement your favourite server-side framework. It streamlines your build and development processes through the following features:
177
178- Bundling JS/TS via Webpack
179- On-screen ESLint and/or TSLint feedback
180- Compiling sass and scss files
181- Bundling svgs via SVGStore
182- Copying static fonts, images and other files, with support for extending their workflows.
183- Live-reloading via browsersync and webpack hmr (dev), with support for React Hot Module reloading
184
185To be exact, Timpla uses the following technologies:
186
187- Gulp
188- Webpack
189- BrowserSync
190- Node-sass
191- Babel
192- SVGStore
193- ESLint (dev-only)
194- TypeScript
195- TSLint (dev-only)
196
197Timpla also provides TSLint and ESLint support for development-mode. Having errors on an overlay are helpful! On production builds, Timpla disables these to speed up compilation times. Please use an alternative process for production builds, if you wish to lint files.
198
199Timpla started as a fork of [Blendid](https://github.com/vigetlabs/blendid), and continues to carry the torch for providing awesome server-side-driven dev experiences.
200
201## Configuring Timpla
202
203One of Timpla's aims is to be zero-configuration. By default, Timpla is set to run in HTML mode and displays an html page. Browsersync may be used to `mount` on top of your existing project.
204
205The most basic Timpla configuration follows:
206
207<!-- inject:timpla_config_basic:js -->
208<!-- endinject -->
209
210Tasks such as html, static and images copy files from the src to the dest folder. Use the `alternate` option to define processing logic. To keep Timpla light, no preprocessing happens for image and other static files. It is left to you to add your preferred workflows. (see alternate configs for reach of the asset tasks below)
211
212Full configuration is available through `.timplaconfig.js`. You'll get a copy in your project's root folder after running `npx timpla init`.
213
214Timpla exports a helper function called `configure`. Use this to create a timplaconfig object in your `.timplaconfig.js`. As an added benefit, your IDE's intellisense should suggest what options are available!
215
216### List of available options
217
218[Full TS documentation](https://igimanaloto.github.io/timpla/interfaces/_lib_timplainterfaces_.ifulltimplaconfig.html) of the timpla config object is available for viewing. An excerpt of the full timpla config follows:
219
220<!-- inject:timpla_config:ts -->
221<!-- endinject -->
222
223### The timplaHelper object
224
225The following variables are available from the timplaHelper
226
227```javascript
228const timplaHelper = {
229 browserSync, // Access the browserSync instance.
230 gulp, // A gulp instance that can be used to register new tasks.
231 projectDestPath, // Resolves a list of strings to the project's dest path.
232 projectSrcPath, // Resolves a list of strings to the project's src path.
233 timplaConfig, // The full timplaConfig
234 timplaProcess, // Provides useful constants such as isDevelopment, isProduction and INIT_CWD (your project's resolved base path).
235}
236```
237
238### Specifying a config file on runtime
239
240To specify a timpla config on runtime, you may set the TIMPLA_CONFIG_FILE env like so:
241
242`TIMPLA_CONFIG_PATH='./relative/path/to/file' npx timpla [command]`
243
244### Overriding babel & babel-loader options
245
246You may use javascripts.babelLoaderOptions to fully control how the webpack babel-loader works.
247
248Babel config resolution is set to default, so babel.config.js and babelrc files are picked up by Timpla. We recommend using babel.config.js as opposed to a babelrc so that npm linked modules are also picked up by babel-loader, via Babel's root config resolution mechanism.
249
250Timpla copies the following babel config file to your project folder. (babel.config.js) and pre-configures your .timplaconfig.js to pick this up.
251
252<!-- inject:babel:js -->
253<!-- endinject -->
254
255### Configuring Webpack
256
257Webpack by default uses the following plugins (module.rules):
258
259```sh
260# HardSourceWebpackPlugin - disabled for now, as caching may break babel-loader 7.2 builds.
261TerserPlugin # uglifies/minifies code
262SpeedMeasurePlugin # Shows a useful breakdown of Webpack compilation speed. Runs when DEBUG=timpla is set.
263ForkTsCheckerWebpackPlugin # creates a forked (separated) TSLint server to run alongside Timpla
264BundleAnalyzerPlugin # provides a visual report of js bundle sizes
265```
266
267Each of these plugins are configurable/can be disabled. For example, javascripts.tslint.forkTsCheckerOptions accepts ForkTsCheckerWebpackPlugin configuration options.
268
269In certain scenarios, Timpla lazy-loads plugins. This gives you the flexibility to `remove` packages that you don't need :). For example, setting javascripts.tslint to false disables tslint and loading the module itself. As a result, you may remove tslint and ForkTsCheckerWebpackPlugin from your dependencies.
270
271Webpack also uses the following loaders:
272
273```
274babel-loader (ESNext and TypeScript support)
275eslint-loader (dev-only)
276```
277
278You have access to the full webpack configuration before it gets fed to Webpack itself. This way, you can add extra loaders you wish to use. Please use the javascripts.customizeWebpackConfig rule in .timplaconfig.js. It accepts a function that returns a configuration object:
279
280```javascript
281// .timplaconfig.js
282{
283 // ... the rest of your config file
284 javascripts: {
285 customizeWebpackConfig({
286 webpackConfig,
287 timplaConfig,
288 timplaProcess,
289 webpack,
290 projectDestPath,
291 projectSrcPath,
292 webpackMerge
293 }) => {
294 const modifiedConfig = { ...webpackConfig }
295 // You can modify the config to how you want it
296
297 // check if it's prod or development
298 if (timplaProcess.isProduction) {
299 // do this;
300 }
301 if (timplaProcess.isDevelopment) {
302 // do this
303 }
304
305 // or even modify rules & plugins...
306 modifiedConfig.plugins = modifiedConfig.plugins.filter(yourFilterFunction)
307 modifiedConfig.module.rules.push(yourOwnRule)
308
309 // or with the webpack merge plugin, you can even do a webpackMerge(webpackConfig, require('./yourOverrides'))
310
311 return modifiedConfig
312 }
313 }
314}
315```
316
317### Overriding tasks
318
319You may overwrite any listed tasks with an alternate option. Please provide a higher order function (a function returning a function) that accepts a timplaHelper object. You may use these to help write the tasks. The higher order function should signal gulp completion: either through a manual callback call or by returning a gulp stream. If in doubt, always return an Undertaker TaskFunction!
320
321A contrived example follows.
322
323```javascript
324{
325 // ... the rest of your timpla config
326 stylesheets: {
327 // ... the rest of your stylesheets config
328 alternate({
329 browserSync,
330 gulp,
331 projectDestPath,
332 projectSrcPath,
333 timplaConfig,
334 timplaProcess,
335 }){
336 const stylesheetsConfig = timplaConfig.stylesheets // access the stylesheets config
337 const paths = {
338 src: projectSrcPath(stylesheetsConfig.src, '**/*.{' + stylesheetsConfig.extensions + '}'),
339 dest: projectDestPath(stylesheetsConfig.dest),
340 }
341
342 // We must return a higher order function
343 return (cb) => {
344 // if gulp is not being used, cb can be used to call signal completion
345 // dosomethingElse();
346 // cb()
347
348 // We can also return a gulp stream instead
349 return gulp
350 .src(paths.src) // finds [your-project]/stylesheets/something.txt
351 .pipe(yourOwnSassProcesser())
352 .pipe(gulp.dest(paths.dest)) // transfers the file to [your-project]/stylesheets/somethingelse.txt
353 .pipe(browserSync.stream()) // streams changes to browserSync
354 }
355 }
356 }
357}
358```
359
360### TypeScript
361
362By default TypeScript and TSLint are enabled. TypeScript functionality is provided through babel-loader and @babel/preset-typescript. TSLint is enabled by default for development mode.
363
364Timpla uses babel-loader with @babel/preset-typescript and [Fork TS Checker Webpack Plugin](https://github.com/Realytics/fork-ts-checker-webpack-plugin) to process TypeScript files. To improve compilation times, Timpla utilises the Fork TS Checker Webpack Plugin to create a separate linting process for TypeScript. Any linting errors won't block the webpack compilation process but will display either in the console or as an overlay on the web page.
365
366For production builds, TSLint is disabled. We've found that it is better to run TSLint as a separate production process.
367
368### Disabling TypeScript / TSLint
369
370If you followed the installation instructions above, please uninstall the following packages: `fork-ts-checker-webpack-plugin`, `tslint`, and `typescript`. Remove @babel/preset-typescript from babel.config.js. Finally, set javascripts.development.tslint to false.
371
372### ESLint
373
374ESLint is enabled for dev-mode. Timpla requires you to have an eslintrc file in your project directory, as well the eslint-loader package installed. Eslintrc resolution is left to the eslint-loader plugin, which means that it should pick up child-dir eslintrc files.
375
376### Disabling ESLint
377
378Set javascripts.development.eslint to false if you don't require it. As eslint-loader is loaded conditionally, you may uninstall it if you don't require eslint.
379
380## The three levels of reloading
381
382### BrowserSync injection and reloading
383
384Timpla uses BrowserSync to inject stylesheets and notify the browser of full-reloads when files change. Timpla pre-configures the watched files for you, but you may also extend it through the `files: [globs]` config.
385
386```javascript
387module.exports = {
388 browserSync: {
389 files: ['when_this_changes_reload_the_page/**/*'],
390 },
391}
392```
393
394When writing your own tasks, Timpla Helper passes the browserSync instance so you may stream(inject) your changes on the fly!
395
396### Hot module reloading + React HMR
397
398Any files you mark as hot won't cause the browser to reload. This is useful when you need to keep the browser in its current state.
399
400Hot module reloading is enabled by default. Setting `javascripts.development.webpackHotMiddlewareOptions` to `false` disables it.
401
402To support react hot module reloading, please install and add `react-hot-loader/babel` to your `babel.config.js`'s plugins. This should be fine even for production builds, as react-hot-loader adds minimal footprint to your code.
403
404#### Dev-server reloading based on config file changes
405
406Timpla fully reloads the dev-server whenever your config files such as babel config, tsconfig, tslint and eslint files change. This saves you the hassle of having to restart just to test configuration settings!
407
408You may also extend the watched files/folders by adding them to .timplaconfig.js > development.timplaWatch. Timpla iterates through these files and sets up reload watchers. You may provide resolved or relative paths.
409
410Setting `development.timplaWatch` to `false` disables the reload server.
411
412## Common setups
413
414### Using Timpla as a static html workflow
415
416Out of the box, Timpla is configured to serve an html page.
417
418### Using Timpla with an existing site (Proxy option)
419
420More often than never, server-side frameworks run your site on localhost (or a locally configured server). Timpla can mount on your site through BrowserSync's proxy option.
421
422To use timpla with an existing site, you may follow the sample browsersync config below. You run your server-side framework and Timpla in a separate process. Use the browserSync option in .timplaconfig.js to set BrowserSync options - it accepts a configuration object. An example of getting it to work with Django/Rails/Laravel follows:
423
424```javascript
425// .timplaconfig.js
426const { configure } = require('timpla')
427const path = require('path')
428
429// You would most probably want to react to template changes, you may set extra folders here (relative)
430const extraWatchFiles = ['templates/**/*']
431
432// The local instance of your site that Timpla will proxy to
433const proxyTarget = 'http://127.0.0.1:7025'
434
435// Access the site via localhost:localhostPort
436const localhostPort = 5605
437
438// If you are using nginx/htaccess to point a host to a local port
439// This is useful if CORS headers are set on your local site resources (CDN)
440const host = 'http://local-new.grabone.co.nz'
441
442module.exports = configure({
443 browserSync: {
444 proxyTarget,
445 files: extraWatchFiles,
446 port: localhostPort,
447 cors: true,
448 proxy: {
449 target: proxyTarget,
450 proxyReq: [
451 // Additional request headers may be added here
452 function(proxyReq) {
453 proxyReq.setHeader('host', host.replace(/^https?:\/\//i, ''))
454 // grabone authentication requires proper host header to be set
455 proxyReq.setHeader('Access-Control-Allow-Origin', '*')
456 },
457 ],
458 },
459 files: files.map(fileGlob => path.join(process.env.PWD, fileGlob)),
460 host,
461 // Prevent browsersync from automatically opening the site (can get annoying pretty quickly)
462 open: false,
463 online: false,
464 },
465 // ... the rest of your config
466})
467```
468
469### Replacing the html task with Shopify Liquid templating
470
471The following example shows how to get Shopify liquid templating support. We'll override the html task to run the html files through liquidr via gulp-liquidr.
472
473The same approach can be made to pull in gulp-pug, gulp-haml, gulp-slim and gulp-jinja!
474
475```javascript
476// make sure to run npm i --save gulp-liquidr first
477const { configure } = require('timpla')
478const liquidr = require('gulp-liquidr')
479const changed = require('gulp-changed')
480
481module.exports = configure({
482 // ... the rest of your file
483 html: {
484 src: 'html',
485 dest: './',
486 // An alternative task may be defined to replace the default
487 alternate({ gulp, env, timplaConfig, browserSync, projectSrcPath, projectDestPath }) {
488 const htmlConfig = timplaConfig.html
489 const paths = {
490 src: [projectSrcPath(htmlConfig.src, '**/*.html')],
491 dest: projectDestPath(htmlConfig.dest),
492 }
493
494 return () =>
495 gulp
496 .src(paths.src)
497 .pipe(changed(paths.dest))
498 .pipe(
499 liquidr({
500 root: [projectSrcPath(htmlConfig.src)],
501 data: {
502 accessMeInYourTemplate: 'ishouldwork',
503 },
504 // other config available from https://www.npmjs.com/package/gulp-liquidr
505 })
506 )
507 .pipe(gulp.dest(paths.dest))
508 .pipe(browserSync.stream())
509 },
510 },
511})
512```
513
514## Common Problems
515
516### I'm getting a different version of dependency X when I use Timpla!
517
518Run `npm i --save/--save-dev [your-package`] to ensure that Webpack picks up your preferred package version.
519
520### Timpla doesn't pick up changes to my eslintrc
521
522This is a known [issue](https://github.com/webpack-contrib/eslint-loader/issues/214) with eslint-loader. Ensure that cache is turned off whilst a patch is being worked on. Alternatively, you may specify your own eslint caching strategy via `cacheIdentifer`.
523
524### When I build, javascript files don't work!
525
526We have encountered this happening whenever you switch the `production.rev` setting. Please clear `./node_modules/cache` to force-clear all caches and try again!
527
528### process.cwd() isn't working as it's supposed to!
529
530Gulp / Timpla sets the process.env.INIT_CWD to the current projectRoot whereas process.cwd() points to the node_modules/timpla folder. Please ensure that you use INIT_CWD instead to resolve to projectPaths.
531
532### Tips for working with npm linked dependencies
533
534Ensure that you are using a babel.config.js. This will allow babel-loader to process the linked module files (TypeScript and ESNext).
535
5361. npm link yourmodule
5371. set up a module.resolve rule for webpack e.g. yourmodule\$: path.resolve(\_\_dirname, 'node_modules/yourmodule/src/index.ts')
538
539## CAQIAs (Commonly asked questions I ask)
540
541<details>
542 <summary>Is this workflow right for me?</summary>
543 <p>
544 If you are working on a server-side web framework like Django, Rails, Laravel, Shopify, Wordpress, Drupal or Craft - then yes! Timpla works along-side your engine's web templating system by dealing only with building your site assets. Timpla provides live-reloading and a sweet build process - so you can worry less about setup and more about writing code!
545 </p>
546 <p>
547 If you are working on a single page application or a client-side library/framework (e.g. Vue, React and Angular), it's best to go for a client-side boilerplate. The returns will diminish with no-backbone apps.
548 </p>
549</details>
550<details>
551 <summary>Gulp? Task runners are no longer required!</summary>
552 <p>Gulp still solves the issue of running tasks. Instead of polluting your npm run scripts or ad-hoc writing your build scripts, Gulp provides an easy-to-pick-up DSL for writing tasks.</p>
553 <p>Although gulp plugins are long past their debut, most of them are still relevant to our tasking needs.</p>
554 <p>Gulp is useful as it opens up streams to BrowserSync and Webpack.</p>
555</details>
556<details>
557 <summary>Gem/plugin/package X provides webpack middleware...</summary>
558 <p>
559 Yes, there are packages, gems or composer plugins that allow injecting webpack via middleware into your asset pipeline.
560 </p>
561 <p>
562 These tools are great, but often do we care less the older project dev environments get. By delegating the `core` to Timpla, we hope that more focus is put on extending, rather than maintaining!
563 </p>
564 <p>
565 Also, we often get into the framework-exclusivity. Think of Timpla as a consistent tool to bring over to projects.
566 </p>
567</details>
568<details>
569 <summary>How different is this from Blendid?</summary>
570 <p>
571 After a fork to upgrade dependencies, it was decided to branch out to provide an updated and extensive configuration framework.
572 </p>
573</details>
574<details>
575 <summary>Does it optimise images or fonts?</summary>
576 <p>Timpla only copies images and fonts to their destination folders. It is recommended that you optimise the images separately, so as not to overload the build process. If you really want to, use the alternate() config.</p>
577</details>
578<details>
579 <summary>Why not inject stylesheets?</summary>
580 <p>Critical-css, lesser requests through service workers / caching and css-in-html have benefits too :)</p>
581</details>
582<details>
583 <summary>Is this production ready?</summary>
584 <p>We use Timpla for [Grabone](https://grabone.co.nz). We invite you to share ideas, and raise issues if you find any! The added benefit of reusing existing gulp tasks is that they are tested independently, dropping the need to duplicate tests!</p>
585</details>
586
587## Developing the plugin
588
589Files are written in TypeScript, so program to your heart's content. Dev plugins are loaded only in your environment, so they don't get shipped as part of the main package!
590
591```sh
592cd [timpla folder]
593npm install
594npm run lib:start # starts the tsc watcher, compiling gulpfile.ts on the go.
595
596# In a separate terminal
597cd [your project]
598npm link timpla
599```
600
601When npm-linked, make sure you execute your commands using `timpla`.
602
603## Releasing the plugin
604
6051. Make changes
6061. pr > Commit those changes to a separate PR
6071. pr > Make sure Travis turns green
6081. master > Merge PR
6091. master > Bump version in package.json
6101. master > npm run lib:changelog (needs to be installed first)
6111. master > npm run lib:docs (builds the ts-docs and readme files)
6121. master > Commit package.json and docs, README.md and CHANGELOG.md files
6131. master > Tag
6141. master > Push
6151. npm publish