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

broken bower.json #52

Closed
alwin-rewedigital opened this issue Feb 19, 2016 · 5 comments
Closed

broken bower.json #52

alwin-rewedigital opened this issue Feb 19, 2016 · 5 comments

Comments

@alwin-rewedigital
Copy link

Hi,

maybe I'm completely lost, but when I look at your bower.json the normalize/_import-now.scss file is marked as main file.

There are some instructions on how to use your lib, but there is no real scenario on how to use it with bower, except of the note that you have to override some things to use it with wiredep.

We want to use css libs from our project by just running bower install and adding an @import line in our main css.

In your case, the main file is in the ./normalize Folder. Normally other css libraries use the main file in the root namespace but you don't, so we can't use your Project in the same generic way with Sass include paths.

If there is nothing against from your side using the normalize-scss/sass/_normalize.scss instead of normalize-scss/sass/normalize/_import-now.scss you'd help us and properly all wiredeps user as well.

If you agree to that, I can open a PR.

Greets
`Alwin Mark

@JohnAlbin
Copy link
Owner

Normally other css libraries use the main file in the root namespace but you don't

Ruby Sass will render any Sass files found anywhere in the project if you put your main Sass file in the root. So it becomes impossible to bundle documentation or example projects that may have Sass files in them too.

I've never seen a Sass project put their main file in the project root. e.g. Bootstrap does it similarly: https://github.com/twbs/bootstrap-sass/blob/master/bower.json So you'd need to add bower_components/bootstrap-sass/assets/stylesheets to your import paths.

we can't use your Project in the same generic way with Sass include paths.

Can you be more specific about your generic method? I don't see how normalize-scss having its main file be sass/normalize/_import-now.scss makes it harder to set up the import path of bower_components/normalize-scss/sass. Edit: is it because the main file is in a sub-folder of the expected import path?

@JohnAlbin
Copy link
Owner

There are some instructions on how to use your lib, but there is no real scenario on how to use it with bower, except of the note that you have to override some things to use it with wiredep.

I use npm to package my Sass. Since I don't use Bower for that task, I would love to have someone provide instructions on a "normal way" to use normalize-scss with Bower. I have the wiredep instructions on the README because someone provided them. :-)

@alwin-rewedigital
Copy link
Author

It's a namespace issue. Let me explain it in detail:

Bower is capable of main files, so in your build process, you can bower provide you any main files of any project. (With some filtering you can than choose for example which filetype you want). There are different Grunt/Gulp Tasks which are doing that in a similar way.

the Problem

Currently (@master) the bower main file points to: sass/normalize/_import-now.scss.
Basically that's ok so far.
The problem occurs because of namespacing issues, as _import-now.scss is doing following imports:

@import 'normalize';

Now that tells the sass compiler to search for a normalize.scss in the same directory as _import-now.scss, which is sass/normalize/normalize.scss.
Here is the Problem, as normalize.scss is at the folder above.

Explaining my solution:

As I then took a look at the _normalize.scss I thought this is a way better main file.

  1. this file uses the namespace in a way I can use it with bower. (So the main File is in the root of the sass namespace)
  2. it does not force me to do a @include normalize(); so I can print it at my wish.

Other solutions that (might) would work for me

  1. moving _import-now.scss into the sass folder
  2. using @import ../normalize in _import-now.scss (I would have to test that first)

I don't know who is also using bower with normalize-scss, but while rethinking everything, maybe moving the _import-now.scss file would be the less invasive solution.

@JohnAlbin
Copy link
Owner

Hmm… If there are various gulp/grunt modules that can import the main file from bower.json, then most of those users would not want to use the normalize/import-now partial that renders the CSS immediately; they probably just want the mixins.

Okay, I'm going to make the _normalize.scss the default main file. And also change the path in _import-now.scss to use a ../

@JohnAlbin
Copy link
Owner

I merged #53

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

2 participants