tminglei / browserify-bower

A browserify plugin, to enable you use bower components just like node modules
MIT License
20 stars 3 forks source link

How to exclude bower packages? #10

Closed Tecktron closed 8 years ago

Tecktron commented 8 years ago

I use npm as a build tool and I use a few scss packages from bower (since I prefer it for frontend package management). I'm trying to get browserify-bower to ignore these packages in the bower directory since the "main" is a .scss file and I keep getting:

@import 'susy/language/susy';
^
ParseError: Unexpected character '@'

I've added this into my package.json, as the the readme seems to suggest(?), but it's not helping.

"browserify-bower": {
        "require": {
            "exclude": [
                "susy"
            ]
        }
    }

My call is not complex, I just want to bundle everything in the bower_components directory. browserify ./js/vendor.js -d -p [browserify-bower] > ./dist/js/bundle.js

vendor.js: (even though it doesn't yet get parsed).

require('jquery');
require('lodash');
require('backbone');

Am I missing something? Any help would be appreciated. Thanks.

tminglei commented 8 years ago

How do you configure the package.json, is it like this?

...
"browserify": {
  "plugin": [
    ...
    ["browserify-bower", {
      "require": {
        "exclude": [
          "susy"
        ]
      }
    }]
  ]
}

I didn't use it in my project, but @ashlinallen and I discussed it in #7 .

Tecktron commented 8 years ago

I was not using this in the plugin array. Maybe add this example to the readme? Thanks for clarifying.