Giter Club home page Giter Club logo

Comments (3)

larixer avatar larixer commented on May 12, 2024

Hi Joe,

Yes, I think the order need to be changed vice versa, e.g. bootstrap.scss need to be loaded first, and styles.scss second.

The reason for separation is to speed up hot code reload for styles. Bootstrap styles are pretty big and we wanted to separate them out, so that they don't slow down reloading times of custom styles during development.

from apollo-universal-starter-kit.

josephdburdick avatar josephdburdick commented on May 12, 2024

Just following up here, it looks like splitting up the files like they are now increases build speed but one of the largest benefits of Bootstrap is being able to build with their variables available so developers can stick to a convention and not have to name things on their own. Running the project requesting a very popular variable returns in an error:

// styles.scss
ERROR in ./~/css-loader!./~/sass-loader!./src/ui/styles.scss
Module build failed:
  background-color: $brand-primary;
                   ^
      Undefined variable: "$brand-primary".
      in /Users/jb/Sites/forks/apollo-fullstack-starter-kit/src/ui/styles.scss (line 10, column 21)
Error:
  background-color: $brand-primary;
                   ^
      Undefined variable: "$brand-primary".
      in /Users/jb/Sites/forks/apollo-fullstack-starter-kit/src/ui/styles.scss (line 10, column 21)
    at options.error (/Users/jb/Sites/forks/apollo-fullstack-starter-kit/node_modules/node-sass/lib/index.js:291:26)
 @ ./src/ui/styles.scss 2:18-127 19:6-27:8 20:18-127
webpack-for-backend Time: 82ms

Unfortunately the only way to solve this is to import the bootstrap file within styles.scss to get access to the variables that Bootstrap already defined. I think the average developer looking at this repo will probably figure that out, but maybe a note should be made about this in the README. I do understand some developers want Bootstrap basics and don't care about variable access.

For what it's worth, the style update speed is pretty fast either way. Without summoning bootstrap from style.scss it's about ~2 seconds on a 2016 Macbook Pro. Calling bootstrap from within style.scss and not having 2 files in html.jsx is about ~3 seconds.

from apollo-universal-starter-kit.

larixer avatar larixer commented on May 12, 2024

@josephdburdick Let's maybe merge styles.scss with bootstrap.scss then. Incremental build speedup time seems not worth the trouble and confusion it creates...

from apollo-universal-starter-kit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.