Dan503 / gulp-auto-imports

Auto generate import-only files for any file type. SCSS, JS, TS, Pug, whatever you want.
MIT License
1 stars 0 forks source link

Take folder order preference into account when order retention is enabled #8

Closed Dan503 closed 5 years ago

Dan503 commented 6 years ago

With a gulp task like this:

gulp.task('load:scss', function () {
    var dest = local_theme_folder+'/sass';
    return gulp.src([
        local_theme_folder+'/sass/variables/**/*.scss',
        local_theme_folder+'/sass/mixins/**/*.scss',
        local_theme_folder+'/sass/components/**/*.scss',
        local_theme_folder+'/sass/pages/**/*.scss',
    ])
        .pipe(fileLoader({ preset: 'scss', dest: dest, fileName: '__includes.scss' }))
        .pipe(gulp.dest(dest))

The user wants the variables import to always be placed toward the top of the import file.

Currently any new variable files that are added are added to the bottom of the file which is annoying because you need to manually move them into position every time.

Dan503 commented 6 years ago

Instead of just pasting the new import at the bottom of the file, I should try and keep the folders grouped together by analysing how close of a match each line is to the file in question and place it underneath the line that is the closest match to the path in question.

Dan503 commented 5 years ago

Fixed in v2.1.0