Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: dependency map #49

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

bustbr
Copy link

@bustbr bustbr commented Jan 20, 2017

This feature allows to specify extra dependencies of files, much like the extra option, but instead of a single array (or string or glob), which is mostly useful when generating only a single output file, the map feature allows a gulp task to rebuild only the necessary files even in a many:many situation.

const depMap = {
  "/some/place/a.scss": [
    "/some/place/else/b.scss",
    "/some/place/else/c.scss"
  ],
  "/some/place/d.scss": [
    "/some/place/else/b.scss"
  ],
  "/some/place/e.scss": [
    "/some/place/a.scss"
  ]
};
gulp.task('build:styles', function() {
  return gulp.src('/some/place/*.scss')
      .pipe(newer({
        dest: "dist",
        dependencyMap: depMap
      }))
      .pipe(sass())
      .pipe(gulp.dest('dist'));
});

Tim B added 4 commits January 19, 2017 19:13
`dependencyMap` may contain an object, giving a map of dependencies for any input file
it has the same effect as the `extra` option, but allows to set the dependencies per input file, as opposed to globally
"Block-scoped declarations (let, const, function, class) not yet supported outside strict mode"
@bustbr
Copy link
Author

bustbr commented Feb 15, 2017

Hi,

I'd like to find out what's stopping this pull request from being merged into upstream.
I understand that another approach, instead of supplying a static map, would be to allow "extras" to be a function, like requested in this issue #48

I need this feature for a project and I'd love to have it be part of the main repository, not only in a fork of mine I'd have to keep up to date if any features are added to gulp-newer.

Thanks in advance.

@macfiss
Copy link

macfiss commented Jul 24, 2017

@bustbr, Hello. Not working :(

let src = [
   'src/core/styles/**/[^_]*.styl',
   'src/vendor/styles/**/[^_]*.styl'
];
return gulp.src(src, {cwd: config.root}) //src/core/styles/styles.styl
               .pipe(newer({
                   dest: config.dest.css,
                   ext : '.css',
                   dependencyMap: {
                        'src/core/styles/styles.styl': [
                            'src/blocks/header/default/styles/style.styl',
                           //or 'src/blocks/*/*/styles/style.styl',
                        ] 
                   }
                   //extra: '!src/core/styles/styles.styl'
               }))
             //....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants