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

not parsing files with ../ #10

Closed
gilbarbara opened this issue Jul 3, 2015 · 12 comments
Closed

not parsing files with ../ #10

gilbarbara opened this issue Jul 3, 2015 · 12 comments

Comments

@gilbarbara
Copy link

hey,

The new version 2 isn't working with files starting with ../
Like @import '../../node_modules/c3/c3.css'; with or without url()
I've tried to load ../minified/d.css into complete/styles.css in the tests directory but no luck.

@unlight unlight added the bug label Jul 3, 2015
@unlight
Copy link
Owner

unlight commented Jul 3, 2015

@gilbarbara Sorry, but I cannot reproduce your case.

This file is parsed without errors.

Can you provide more details about your case?

@gilbarbara
Copy link
Author

Hey!
this is the troubling file:
app/styles/main.scss

// bower:css
@import '../../bower_components/pickadate/lib/themes/default.css';
@import '../../bower_components/pickadate/lib/themes/default.date.css';
@import '../../bower_components/pickadate/lib/themes/default.time.css';
// endbower

@import '../../node_modules/c3/c3.css';

This is my gulp task:

return gulp.src('app/styles/main.scss')
  .pipe($.sass.sync({
      includePaths: ['bower_components/'],
      precision: 10
  }).on('error', $.sass.logError))
  .pipe($.autoprefixer({
      browsers: AUTOPREFIXER_BROWSERS
  }))
  .pipe($.cssimport({ matchPattern: '*.css' }))
  .pipe(gulp.dest('.tmp/styles'));

I've tried to pipe the already parsed .css straight to gulp-cssimport and it didn't work anyway.

@unlight
Copy link
Owner

unlight commented Jul 3, 2015

That is minimatch problem for some reason pattern *.css does not match for ../../x.css paths.
You need pass minimatch options matchBase: true to plugin options:
E.g.

var options = {
    matchPattern: '*.css',
    matchOptions: {
        matchBase: true
    }
};

stream = gulp.src("style.css")
   .pipe($.cssimport(options))

@unlight
Copy link
Owner

unlight commented Jul 3, 2015

I made option matchBase: true by default. It make sense.

@gilbarbara
Copy link
Author

hey, I'm trying with the new matchBase option.
It does parse the .css files however it's messing with the dest path

return gulp.src('app/styles/main.scss')
    .pipe($.plumber())
    .pipe($.sass.sync({
        includePaths: ['bower_components/'],
        precision: 10
    }).on('error', $.sass.logError))
    .pipe($.plumber.stop())
    .pipe($.autoprefixer({
        browsers: AUTOPREFIXER_BROWSERS
    }))
    .pipe($.debug())
//gulp-debug: app/styles/main.css
    .pipe($.cssimport({
        matchPattern: '*.css',
        matchOptions: {
            matchBase: true
        }
    }))
    .pipe($.debug())
//gulp-debug: app/styles/main.css
    .pipe(gulp.dest('.tmp/styles'))
    .pipe($.debug())
//gulp-debug: ../../app/styles/main.css

The last path should be .tmp/styles/main.css instead of ../../app/styles/main.css

Any ideas?

@unlight
Copy link
Owner

unlight commented Jul 3, 2015

No ideas.
Run task with $.debug() and with --verbose option ans show the result.

@gilbarbara
Copy link
Author

I got an error in $.debug using --verbose after gulp-cssimport parses the first file and it's unable to finish.
something related to date 😁

gulp-debug: 1 items
gulp-debug: 
cwd:   ~/sai
base:  ~/sai/node_modules/c3
path:  ~/sai/app/styles/main.css

node_modules/gulp-debug/node_modules/stringify-object/index.js:42
    return "new Date('" + val.toISOString() + "')";

RangeError: Invalid time value

@unlight
Copy link
Owner

unlight commented Jul 3, 2015

Well, replace in node_modules\gulp-debug\index.js stringifyObject() by JSON.stringify(), and try again.

@gilbarbara
Copy link
Author

hey,
I can't spent more time with this issue today, I'll keep using version 1.x for now. I'll try again later.

thanks

@unlight
Copy link
Owner

unlight commented Feb 28, 2016

I have rewritten part with resolving paths, which leads to bogus destination paths.
Please, try new version npm i unlight/gulp-cssimport#3.0, it is not published yet @ npm.

@unlight
Copy link
Owner

unlight commented Feb 29, 2016

FIxed in 3.0+

@unlight unlight closed this as completed Feb 29, 2016
@gilbarbara
Copy link
Author

Sweet, I'll try it tomorrow!
Thanks

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

No branches or pull requests

2 participants