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

Can I add bourbon v5 (beta) to my project with Bower? #991

Closed
Trost123 opened this issue Jan 25, 2017 · 19 comments
Closed

Can I add bourbon v5 (beta) to my project with Bower? #991

Trost123 opened this issue Jan 25, 2017 · 19 comments

Comments

@Trost123
Copy link

I'm using Autoprefixer, so a lot of mixins from bourbon v4 conflict with it. Bourbon v5 (beta) fixed this issue, is there any way to add it to my project using Bower?

@mistergraphx
Copy link

mistergraphx commented Jan 25, 2017

Add this to your bower.json

"dependencies": {
        "bourbon5":"bourbon#v5.0.0.beta.7",
    }

@tysongach
Copy link
Contributor

I’m going to close this issue, as it appears to be resolved.

Couple things worth noting:

  • Installing the beta from the command line is also possible: bower install bourbon#v5.0.0.beta.7
  • Autoprefixer will also remove out-of-date prefixes, so there shouldn’t be a conflict per se with using Bourbon 4.x with Autoprefixer, more that the work of prefixing would be happening in two places. I note this because sometimes a Bourbon upgrade is not a quick task, but that shouldn’t keep you from introducing Autoprefixer into your toolchain.

@Trost123
Copy link
Author

Thanks, that did the trick!

Is there any way to specify the version in a way, that allows checking for updates?
(analogue of "neat": "^1.8.0")
No big deal if that's impossible, just curious.

@Trost123
Copy link
Author

Trost123 commented Jan 25, 2017

there shouldn’t be a conflict per se with using Bourbon 4.x with Autoprefixer

@tysongach I used "Background Image" mixin, and it resulted in two identical "background-image" rules appearing in my css. Not a deal-breaker but it bothered me.
Overall I prefer to move on to Bourbon5, because a big part of B4 documentation is simly wendor-prefix-mixins, which I don't really need to know.

@mistergraphx
Copy link

@Trost123 In my workflow i've a folder to store frameworks/libs and my projects load the stuff and tools from this place, so i can deal with multiple versions of bourbon, or others between my projects. Structure and gulp file is here, https://github.com/mistergraphx/Fragments_builder.

@Trost123
Copy link
Author

@mistergraphx Thanks, but I think you misunderstood my second question there.
It's more of a bower-related question (maybe I should post it there?):
Let's pretend I do "bower install bourbon#v5.0.0.beta.7" and then bourbon#v5.0.0.beta.8 is released.
If I use "bower update" in my console - bourbon will not be updated.
Screenshot of issue
I think there must be something like "bower install bourbon#latest" but to install latest pre-release.

@mistergraphx
Copy link

I've understood but not really answered ;-).I gived you an example of switching between multiple versions during the pre-release period.
I'm not a "bower expert" but in the bower registry if your do bower search bourbon it's the version 4 witch is actually downloaded cause it's the stable branch/tag, as in the Ruby gem and It's just the maintainer of a package who choose to publish a new revision of the bower package, see : https://bower.io/docs/creating-packages/#register

That's why we add the specific tag #<tag|branch>, as described in the bower install documentation https://bower.io/docs/api/#install.

You can try to download directly from the master branch using bourbon#master, but i'm not certain it's a good practise if your project is in production ;-)

@Trost123
Copy link
Author

@mistergraphx
I guess we'll just have to update manually until v5 is released as stable, but that's no big deal!
Thanks for the help. 👍

@tysongach
Copy link
Contributor

@Trost123 I don’t use Bower a lot, so can’t speak from experience, but it appears that you can specify a range of versions: bourbon#>=5.0.0.beta.7 <5.1.0. This should match any betas released after beta 7, and also match the stable release of 5.0, including any patch releases (5.0.x).

I just found this neat tool from npm which helps you visualize these SemVer qualifiers: https://semver.npmjs.com/.

@Trost123
Copy link
Author

Trost123 commented Jan 26, 2017

@tysongach Thanks, that's exactly what I needed! And that tool sure is handy.
Also noticed a weird thing:
"npm info bourbon" returns all versions, up to 5.0.0-beta.7'
"bower info bourbon --verbose" returns versions up to 4.2.7
So the problem must be on bower's side, as NPM let's me install ">=5.0.0-beta.7" like you advised and bower doesn't. (installing by tag works in both)
I'll leave you alone go annoy the Bower team from now on. 😈

@tysongach
Copy link
Contributor

Ah, I think there are minor discrepancies between Bower and npm and how they handle SemVer with pre-releases. Some accept a hyphen (-) to denote pre-releases, others only accept periods (.). I can't remember who accepts which formats. I keep meaning to sit down and write it all down for reference later…but just something to watch out for.

@Trost123
Copy link
Author

@tysongach I don't think it's about that.
See this screenshot: Bower actually thinks that 4.2.7 is latest version. Also note that there are older betas in the list (on the screenshot), like "3.2.0-beta.2", so the naming conventions are not the issue here.
Going to post it on Bower repository to figure it out.

@tysongach
Copy link
Contributor

Interesting. Yeah, it would be nice to confirm whether Bower does or does not include pre-release versions when listing.

I think Bower piggy-backs a lot of Git/GitHub tags, so it is possible we didn’t properly tag things right before, or now? It’s very opaque, but I’m intrigued to learn more!

@Trost123
Copy link
Author

Trost123 commented Jan 26, 2017

@tysongach I think I found the pattern. Look at all "beta" and "rc" versions that are in my screenshot.
Versions like "3.2.0.beta.1" are not recognized by Bower correctly, while v3.2.0-beta.1 (or 3.2.0-beta.1) are recognized.
Also if you go to https://semver.npmjs.com/ and enter "bourbon" into "pick a package" field and press enter, you'll see versions output in this format: "5.0.0-beta.5", "4.2.0-pre"

@tysongach
Copy link
Contributor

So this goes back to my comment above on whether a hyphen or period was used to denote the pre-release. Unfortunately, npm and Bower handle this nomenclature differently than RubyGems (which we also publish to).

The Semantic Versioning spec indicates that “A pre-release version MAY be denoted by appending a hyphen and a series of dot separated identifiers immediately following the patch version” (e.g. 1.0.0-alpha.1).

However—if I remember correctly—RubyGems throws an error and will not publish a pre-release denoted by a hyphen, only if it is a period.

There is an open PR to Semantic Version that tries to clarify the correct method (hyphen) and I hope that RubyGems aligns with everyone else.

I found all of this out through trial and error once I took over maintaining Bourbon. I plan to sit down and map all of this out with learnings and note the conflicts. I may have mistakingly versioned things incorrectly, and between Git/GitHub, npm, Bower and RubyGems, we have confusion.

@tysongach
Copy link
Contributor

Here is some documentation from RubyGems on them indicating use of a period to denote pre-releases: http://guides.rubygems.org/patterns/#prerelease-gems

I think the action here is that version number every but RubyGems, needs to utilize the hyphen, in accordance to SemVer. RubyGems appears to be the violator of that spec, so we’ll have to use the period for them here: https://github.com/thoughtbot/bourbon/blob/master/lib/bourbon/version.rb#L2.

@Trost123
Copy link
Author

@tysongach so basically it's either RubyGems error or Bower without automated beta update channel.
Well, nothing else I can do here to help I guess?
Also, should I close the issue on Bower's repo then?

@tysongach
Copy link
Contributor

Nah, I’m curious what they say and see if our assumptions are correct.

@Trost123
Copy link
Author

Trost123 commented Jan 26, 2017

I guess guys at Bower can fix (workaround) it, because NPM actually transforms "." into "-" before "beta"
As seen in "npm info bourbon" output.
So they could do the same.

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

3 participants