Setup Gulp’s script pipeline takes TypeScript source files fromDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/jpachecox/setup-gulp/llms.txt
Use this file to discover all available pages before exploring further.
src/js/, transpiles them through Babel, minifies the output with gulp-uglify, generates inline source maps for debugging, and writes the final .min.js files directly to assets/. There are three parallel script tasks, each targeting a different subdirectory and applying the appropriate filename prefix, mirroring the SCSS naming convention used in the styles pipeline.
js Task
The js task handles root-level TypeScript files at ./src/js/*.ts. It feeds each file through the optimizeJs helper, which runs Babel transpilation, uglification, source map generation, and file renaming in a single pipeline.
Source glob: ./src/js/*.ts
optimizeJs helper used by all three script tasks is:
| Source | Output |
|---|---|
src/js/app.ts | assets/app.min.js |
src/js/theme.ts | assets/theme.min.js |
jsComponents Task
The jsComponents task compiles every TypeScript file found in ./src/js/components/ and prepends component- to each output filename, keeping reusable UI component scripts clearly identified in assets/.
Source glob: ./src/js/components/*.ts
| Source | Output |
|---|---|
src/js/components/cart.ts | assets/component-cart.min.js |
src/js/components/drawer.ts | assets/component-drawer.min.js |
jsSections Task
The jsSections task compiles every TypeScript file in ./src/js/sections/ and prepends section- to each output filename, matching the Shopify section naming pattern.
Source glob: ./src/js/sections/*.ts
| Source | Output |
|---|---|
src/js/sections/product.ts | assets/section-product.min.js |
src/js/sections/collection.ts | assets/section-collection.min.js |
lintJs Task
The lintJs task runs root-level TypeScript files through gulp-eslint, prints a formatted lint report to the console, and fails the process after errors are found so linting failures are visible in CI.
Source glob: ./src/js/*.ts
Babel Configuration
Babel is the transpiler at the core of every script task. The project’sdevDependencies in package.json include the following Babel packages, which together handle modern TypeScript and JavaScript down-compilation:
@babel/preset-env
Transpiles modern JavaScript syntax to a target compatible with the
browserslist setting (last 2 versions). Handles ES modules, async/await, optional chaining, and more.@babel/preset-typescript
Strips TypeScript type annotations and compiles
.ts files to plain JavaScript. Type-checking is handled separately by tsc.@babel/plugin-transform-runtime
Replaces inline Babel helpers with references to
@babel/runtime, reducing output bundle size across multiple compiled files.@babel/plugin-proposal-class-properties
Enables class field declarations (e.g.
class Foo { bar = 1 }) in TypeScript and modern JavaScript source files.