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

Syntax error during sassify (need extra transform?) #30

Open
adjavaherian opened this issue Jul 22, 2015 · 1 comment
Open

Syntax error during sassify (need extra transform?) #30

adjavaherian opened this issue Jul 22, 2015 · 1 comment

Comments

@adjavaherian
Copy link

I just ran into this syntax error with sassify. Perhaps its sassify or its dependencies, but I see a similar issue here. And I'm wondering if I need to do yet another transform on the css output from sassify in order to jive with browserify?

Here's my whole task

var browserify = require('browserify');
var gulp = require('gulp');
var source = require("vinyl-source-stream");
var debug = require('gulp-debug');
var babelify = require('babelify');
var sassify = require('sassify');

gulp.task('browserify', function(){

    //init browserify with entry and transform
    var b = browserify({
        "debug": true,
        "extensions":  [".jsx", ".scss"]
    })
        .transform(babelify)
        .transform(sassify, {
            'auto-inject': false,
            base64Encode: false,
            sourceMap: false
        });

    b.add('server/middleware/react.js');
    b.bundle()
        .pipe(source('index.js')) //read docs for source, index.js is placeholder
        .pipe(process.stdout);

    //return source('server/middleware/react.js')
    //        .pipe(debug());
});

throws:

events.js:85
      throw er; // Unhandled 'error' event
            ^
SyntaxError: Unexpected character '�'

source:

yada yada...
var StyleSheet = require("../scss/templates/AppTemplate");

yada yada...
@import '../includes/includes';
html, body {
    margin: 0px;
    padding: 0px;
    min-width: $screen-sm-min;
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
}
@adjavaherian
Copy link
Author

Update: I think this may be because of a jpg that was required somewhere in the pipeline. I was able to filter out some of them with this transform placed before sassify.

module.exports = function (file, opts) {

    opts = opts || {};

    return through(function (buf, enc, next) {
        var binHex = /\.(jpg|jpeg|png|gif|svg)\b/.test(file);
        if (!binHex) {
            this.push(processRequires(buf.toString('utf8'), opts));
        } else {
            this.push(null);
        }

        next();
    });

};

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

1 participant