Nathan Lippi
Nathan Lippi

Reputation: 5237

Meteor Packages: How to use different CSS based on 'development' or 'production'

There are some CSS @import statements in our code that really slow down Meteor's auto-reload.

I would like to take these out, but only for development.

Inside a Meteor package, neither of the following variables:

is accessible.

Package.describe({
  name: 'a-package',
  version: '0.0.1'
});

Package.onUse(function (api) {
  api.versionsFrom('1.0.2.1');

  // ...

  if(???) {
    api.addFiles('development-fonts.css');
  }
  else {
    api.addFiles('production-fonts.css');
  }
});

Upvotes: 0

Views: 76

Answers (1)

Nathan Lippi
Nathan Lippi

Reputation: 5237

The best way we figured to do it was this:

When starting meteor in development:

`FAST=1 meteor`

Then, inside package.js:

if(!!process.env.FAST) {
  api.addFiles('raisal-dash-common-fonts-development.css', 'client');
} else {
  api.addFiles('raisal-dash-common-fonts-production.css', 'client');
}

Upvotes: 1

Related Questions