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

Bug when using glob to match html files #4

Open
ierhyna opened this issue May 4, 2016 · 4 comments
Open

Bug when using glob to match html files #4

ierhyna opened this issue May 4, 2016 · 4 comments

Comments

@ierhyna
Copy link
Contributor

ierhyna commented May 4, 2016

Hi,
I suppose there is a bug when using glob in gulp.src() to match multiple html files.

I've got 75 html files, and some CSS classes are the same, but there are unique CSS classes in every html file too. I use gulp.src('*.html') to match every html file, but the plugin doesn't copy classes from every file.

Looks like the plugin only gets classes from the last file in array.

My gulpfile.js is as following:

var gulp = require('gulp'),
    posthtml = require('gulp-posthtml');

gulp.task('default', function () {
  return gulp.src('*.html')
    .pipe(posthtml([
      require('posthtml-classes')({
        fileSave: true,
        filePath: './classList.css',
        overwrite: true,
        eol: '\n',
        nested: true,
        elemPrefix: '__',
        modPrefix: '--',
        modDlmtr: '-',
        curlbraces: true
      })
    ]));
});

Gulp v3.9.1
Node v4.4.3
npm v2.15.1

@rajdee
Copy link
Owner

rajdee commented Oct 17, 2016

Hi @ierhyna!
The plugin works as expected.

  • If the overwrite option is enabled (overwrite: true) then the plugin extracts classnames and overwrite the filePath file so that at the end of this file will be overwritten with classes of the last html
  • If the overwrite option is disabled (overwrite: false) then the plugin extracts classnames to separate files.

I think you expect that when this option is enabled (overwrite: true) all the extracted classes have been appended to the end of the file. Is it so?

@ierhyna
Copy link
Contributor Author

ierhyna commented Oct 18, 2016

Hi @rajdee, thanks for the answer.

I'd like to grab all the classes from every HTML file, and put them all into single CSS file. If that's possible, how can I do it?

If it isn't possible yet, I could try to develop this feature.

@rajdee
Copy link
Owner

rajdee commented Oct 18, 2016

Hi @ierhyna!
I can try to realize this logic. Should I remove duplicate classes, which will be inserted in the file?

@ierhyna
Copy link
Contributor Author

ierhyna commented Oct 18, 2016

@rajdee, if it's possible to insert only unique classes it would be nice 👍 Thanks in advance 😃

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

No branches or pull requests

2 participants