Releases: Dan503/gulp-auto-imports
Releases · Dan503/gulp-auto-imports
v3.2.2 - Fixed missing tsDoc comment
v3.2.1 - readme fixes
Readme fixes
v3.2.0 - Typescript presets & createAutoImportTask function
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
v3.1.0 - New js presets
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
v3.0.0 - Renamed to "Gulp Auto Imports"
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.