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

Add vendor path to be ignored #312

Open
wants to merge 4 commits into
base: release-v0.13.0
Choose a base branch
from

Conversation

turizoft
Copy link

Greetings, I've been using Harp.js from some time ago and I realized that when one wants to compile a project, harp will work with each file it finds inside project folder. This can be a drawback when working with tools like Bower. Which creates a subfolder for components a.k.a bower_components. I've seen the open issue about this, but there is no PR yet.

I figured out that the simplest way to do this is passing the compile command a parameter specifying the location of the vendor folder, by default inside [publicPath]/vendor. Harp will ignore this path when compiling and will copy it without altering it to the outputPath.

I read somewhere that .gitignore can be used for this purposes, but knowing that harp's approach is simplicity, I think this solution addresses the problem properly, since it decouples the solution from other factors (like git). And I'd say it covers the 80% or 90% percent of cases when someone needs to ignore a folder.

With respect to the code all test are passing and I've followed harp's coding style.

I've already used this for one mobile app we're developing with Phonegap and an API based static web app. So far so good. No errors and now I can use bower with ease.

I'm keen to any commentary,

Néstor Turizo

@kennethormandy
Copy link
Collaborator

Awesome. I have a couple of projects using npm, I am looking forward to trying them with your fork and will post feedback after. Thanks so much for the hard work.

@kennethormandy
Copy link
Collaborator

This seems to break a bunch of tests, but I’m guessing it’s because the vendor path and output path arguments are switched and the output path was being used in the tests. Is there any reason you switched these around?

@turizoft
Copy link
Author

Sorry about the tests! I was going to add the parameter after the output path, but then I thought its more common to leave output path unspecified (default to www) than the vendor path, it could change more often, like: "bower components" or "vendor".

@jevets
Copy link

jevets commented Jul 16, 2014

This looks great to me. You're right, a simple vendorPath should cover all the use cases. Thanks @turizoft !

@GeoffreyPlitt
Copy link

+1

@electerious
Copy link

Looks like @kennethormandy is planning a different approach as written in #438. Are there any plans when this feature will be implemented? My biggest problem is that compilation fails because of some files inside public/bower_components/. I think this is a pretty big show-stopper.

@GeoffreyPlitt
Copy link

+1, I stopped using this tool because it was failing on my bower
components, I think it's a show-stopper for most people.

On Sat, Jun 13, 2015 at 2:09 PM, Tobias Reich notifications@github.com
wrote:

Looks like @kennethormandy https://github.com/kennethormandy is
planning a different approach as written in #438
#438. Are there any plans when this
feature will be implemented? My biggest problem is that compilation fails
because of some files inside public/bower_components/. I think this is a
pretty big show-stopper.


Reply to this email directly or view it on GitHub
#312 (comment).

http://www.geoffplitt.com
http://facebook.com/geoffrey.plitt
https://twitter.com/GeoffreyPlitt
773.339.0915

@jevets
Copy link

jevets commented Jun 15, 2015

@electerious @GeoffreyPlitt
Not sure if it helps, but I've since switched to Browserify instead of Bower. Been working great for me with a couple easy npm package scripts. This assumes you're building and deploying static files.

Something like

  "scripts": {
    "serve": "harp server",
    "build-js": "browserify public/js/app.js > public/js/bundle.js",
    "watch-js": "watchify public/js/app.js -o public/js/bundle.js",
    "dev": "npm run watch-js & npm run serve",
    "build": "npm run build-js && harp compile"
  }

@howardroark
Copy link

Hey @kennethormandy or @sintaxi ... Maybe it would make sense to add node_modules to the default ignore subset and add bower_components and maybe vendor to the default copy subset?

That is of course if it is an easier route than letting people specify files for both of these cases in the harp.json file.

That would clear up all of the cases where harp compile falls over for me and I'm sure many others. Anything else you can work around. I currently find myself adding and removing my node_modules folder just to compile. I also end up having to gut what I need from what seems to be every other bower project to do the same.

@miljan-aleksic
Copy link

Is there any final solution for this issue? Seems has been forgotten but is a real pain dealing with workarounds for ignoring folders...

@jtraband
Copy link

Still an issue for me as well....

@danactive
Copy link

+1 for .harpignore for README.md and node_modules

@Kilian
Copy link

Kilian commented Jun 12, 2017

With 0.24 the lack of ignored node_modules started breaking our build. an non-compiled public/node_modules in any way would be much appreciated.

Repository owner deleted a comment from electerious Jun 14, 2017
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.

10 participants