Skip to content

Releases: Dan503/gulp-auto-imports

v3.2.2 - Fixed missing tsDoc comment

22 Aug 10:55
Compare
Choose a tag to compare
Added tsdoc comment for createAutoImportTask

v3.2.1 - readme fixes

22 Aug 10:29
f7a583e
Compare
Choose a tag to compare
Readme fixes

v3.2.0 - Typescript presets & createAutoImportTask function

22 Aug 10:28
4b2f297
Compare
Choose a tag to compare

New Typescript Presets

Adds 3 new preset options that are designed for Typescript:

  • "ts" = import fileName from '../relative/path/fileName'
  • "ts_default_exports" = export { default as fileName } from '../relative/path/fileName'
  • "ts_named_exports" = export { fileName } from '../relative/path/fileName'

New placeholder type

The new $noExtPath placeholder allows you to write clean import path names

New createAutoImportTask function

Before (v3.1.x)

var gulp = require('gulp')
var autoImports = require('gulp-auto-imports')

const createScssImporterTask = sourceFolder => {
  const loadTask = `sass:${sourceFolder}:load-imports`
  const watchTask = `sass:${sourceFolder}:watch-imports`

  gulp.task(loadTask, function () {
    return (
      gulp
        .src(`${sourceFolder}/**/*.scss`)
        .pipe(autoImports({ preset: 'scss', dest: sourceFolder }))
        .pipe(gulp.dest(sourceFolder))
    )
  })

  gulp.task(watchTask, function (done) {
    const watcher = gulp.watch(`${sourceFolder}/**/*.scss`)

    watcher.on('add', gulp.series(taskName))
    watcher.on('unlink', gulp.series(taskName))

    done()
  })

  return [ loadTask, watchTask ]
}

const [scssVarsImporter, scssVarsImportWatcher] = createScssImporterTask(
   './source/scss/config/vars'
)
const [scssMixinsImporter, scssMixinsImportWatcher] = createScssImporterTask(
   './source/scss/config/mixins'
)

gulp.task(
   'scss-auto-imports',
   gulp.parallel(
      scssVarsImporter,
      scssVarsImportWatcher,
      scssMixinsImporter,
      scssMixinsImportWatcher,
   )
)

After (v3.2.x)

var gulp = require('gulp')
var { createAutoImportTask } = require('gulp-auto-imports')

const createScssImporterTask = sourceFolder =>
   createAutoImportTask({
      sourceFolder,
      fileExtension: 'scss',
      importerSettings: {
         preset: 'scss',
      },
   })

const [scssVarsImporter, scssVarsImportWatcher] = createScssImporterTask(
   './source/scss/config/vars'
)
const [scssMixinsImporter, scssMixinsImportWatcher] = createScssImporterTask(
   './source/scss/config/mixins'
)

gulp.task(
   'scss-auto-imports',
   gulp.parallel(
      scssVarsImporter,
      scssVarsImportWatcher,
      scssMixinsImporter,
      scssMixinsImportWatcher,
   )
)

Note: the old method still works perfectly fine, v3.2.x just introduces an easier way to implement this common pattern.

v3.1.1

21 Aug 16:34
Compare
Choose a tag to compare

Added the new presets to the "All available presets" section of README.md

v3.1.0 - New js presets

21 Aug 15:56
Compare
Choose a tag to compare

I've added the following presets in this release:

  • "es5_default_exports" = exports.$name = require('$path')
  • "es5_named_exports" = exports.$name = require('$path').$name
  • "es6_default_exports" = export { default as $name } from '$path'
  • "es6_named_exports" = export { $name } from '$path'

I've also moved the settings documentation into an index.d.ts file which in some gulp set ups will make the documentation available to you while editing your code.

v3.0.1

20 Aug 16:51
Compare
Choose a tag to compare

Updated the node version number compatibility image to say the correct version number support.

v3.0.0 - Renamed to "Gulp Auto Imports"

20 Aug 16:50
Compare
Choose a tag to compare

I felt like the name "Gulp File Loader" didn't get across the purpose of the package very well.

I'm much happier with the name "Gulp Auto Imports".

Breaking change!

  • The default file names that the presets output are now variations of "auto-imports". For example, the scss file is now "auto-imports.scss".
  • I also modified the formatting of the output files. This means that linting software that wasn't complaining before might start complaining now.

v2.1.3

18 May 09:50
Compare
Choose a tag to compare

Swapped out the recommended Browserify integration technique in the readme with a much better one.

v2.1.2

18 May 09:49
Compare
Choose a tag to compare

Major re-write of the readme.md. Added examples for how to integrate gulp-file-loader into Browserify and Rollup JS bundler tasks.

v2.1.1

18 May 09:46
Compare
Choose a tag to compare
  • Added VS Code debug file
  • readme edits