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

CSS and fonts disappeared from bower main in latest update #27

Closed
moravcik opened this issue Nov 27, 2015 · 10 comments
Closed

CSS and fonts disappeared from bower main in latest update #27

moravcik opened this issue Nov 27, 2015 · 10 comments

Comments

@moravcik
Copy link

only js/bootstrap.js is listed
which has broken my build, I have to override main manually back to:

"css/bootstrap.css",
"js/bootstrap.js",
"fonts/glyphicons-halflings-regular.eot",
"fonts/glyphicons-halflings-regular.svg",
"fonts/glyphicons-halflings-regular.ttf",
"fonts/glyphicons-halflings-regular.woff",
"fonts/glyphicons-halflings-regular.woff2"
@edgar0011
Copy link

yes, stumbled upon the same issue, last version where it is ok, 3.3.4

@hoppy-kamper
Copy link

This is a conflicting open Issue. Font files should not be included in bower.json. However, css/bootstrap.css does need to be added back. Doing a build with wiredep is broken in the current configuration.

@moravcik
Copy link
Author

Yes, I can see that there is a whole theory why the font files shouldn't be included in the main bower files.

However, as for my build, this would work only in development mode, where all bower_components are used directly. In production build I do uglification and minification of all JS and CSS files, including bower_components, so I need to copy all compiled files and generally all assets to the dist location. For that reason I need to collect also fonts and images delivered as bower components with main-bower-files tool.

There are use cases where let's call them all production files need to be listed as main bower files, especially for complex builds.

@hoppy-kamper
Copy link

Hey @moravcik - according to this pull request only entry points should be listed in Main. Since the Font files are referenced within our css file, the fonts should be "scooped up" by the build script.

I'm am new to this, but I have been using yeoman-angular with grunt to build a github pages site. I changed the bower_componenets/bootswatch-dist/bower.json "main" to be

"main": [
    "css/bootstrap.css",
    "js/bootstrap.js"
  ], 

and my build dist grabbed the fonts just fine.

I hope this helps somewhat. It's cool that you are from Bratislava - my wife and I went backpacking through there a couple of years ago and ate lots of Bryndzové halušky. There was lots of snow - what a beautiful city! And great music everywhere.

@moravcik
Copy link
Author

moravcik commented Feb 1, 2016

@Kamps-Duac, I was playing a little bit with your Kamps-Duac.github.io project.

First of all, generally modifying any files in bower_components is not the best practice. Every time you checkout your project, or you do bower update you loose your changes.

You can do the same thing in your root bower.json, just add:

  "overrides": {
    "bootswatch-dist": {
      "main": [
        "css/bootstrap.css",
        "js/bootstrap.js"
      ]
    }
  }

In my case I add also the font files, as I was describing before.

Well, how your font files get resolved into dist dir? Check following portion of your Gruntfile.js:

// Copies remaining files to places other tasks can use
copy: {
  dist: {
    files: [{
      expand: true,
      dot: true,
      cwd: '<%= yeoman.app %>',
      dest: '<%= yeoman.dist %>',
      src: [
        '*.{ico,png,txt}',
        '*.html',
        'images/{,*/}*.{webp}',
        'styles/fonts/{,*/}*.*'
      ]
    }, {
      expand: true,
      cwd: '.tmp/images',
      dest: '<%= yeoman.dist %>/images',
      src: ['generated/*']
    }, {
      expand: true,
      cwd: 'bower_components/bootswatch-dist',
      src: 'fonts/*',
      dest: '<%= yeoman.dist %>'
    }]
  },
  styles: {
    expand: true,
    cwd: '<%= yeoman.app %>/styles',
    dest: '.tmp/styles/',
    src: '{,*/}*.css'
  }
},

especially this portion:

  cwd: 'bower_components/bootswatch-dist',
  src: 'fonts/*',

so, the build script does the manual copying of bootswatch-dist font files into the dist directory.

I was doing the same thing, but for all assets generally listed in bower main files in all bower components.

Glad to hear you liked Bratislava trip and bryndzove halusky (not everyone likes them). I would recommend visiting also our mountains, especially High Tatras, which are the smallest alpine type mountains in Europe. I have never visited Florida yet, but I liked San Francisco and Yosemite park which I visited 2 years ago, very nice.

@hoppy-kamper
Copy link

Thanks for the override tip @moravcik!

@dbtek
Copy link
Owner

dbtek commented Feb 2, 2016

To comply with the bower spec, as bootstrap does, fonts & css files are removed from main. For wiredep, override method can be used.

@dbtek dbtek closed this as completed Feb 2, 2016
@moravcik
Copy link
Author

moravcik commented Feb 2, 2016

In my opinion the 43 is a big step backward, since it breaks tons of builds and requiring a lot of manual "overrides" sections. This leads many developers to think about bower alternatives, e.g. Migrate away from Bower

Fortunately there is a new spec for "files" section in Bower 47, but anyway I think the "files" spec should be implemented before the meaning of main is deliberately changed.

I understand that this repo is a distribution of bootstrap, so it needs to follow bootstrap bower config. However, I think such big changes should be introduced in new major versions, not minors, which are resolved automatically and causes failing builds.

@hoppy-kamper
Copy link

I understand that this repo is a distribution of bootstrap, so it needs to follow bootstrap bower config.

This is why I am confused. The Bootstrap 3 and 4 bower config does have a stylesheet included in bower.json "main". Also, the bower spec includes an example of "main" having a stylesheet. What am I missing?

@dbtek
Copy link
Owner

dbtek commented Feb 3, 2016

@moravcik I could not agree more, this breaks many builds. However, css files are not entry points. And wiring deps in html and bundling them is whole different thing to discuss.
Bower is not the perfect package manager anyway, migrate to npm if you can.

@Kamps-Duac there is no css files in bootstrap 3 or 4 bower configs; they're less or sass files.

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

4 participants