Semantic-Org / Semantic-UI-Meteor

Official Semantic UI Integration for Meteor
MIT License
224 stars 33 forks source link

Can't change the default theme #24

Closed v3rron closed 7 years ago

v3rron commented 9 years ago

Just added semantic-ui-meteor 2.0.0 version to a fresh Meteor app. Having an issue when trying to switch to any other theme except default.

While building the application:
   client/lib/semantic-ui/custom.semantic.json: Semantic UI Generator: definition/theme "video"" does not exist. Please update your custom.semantic.json file.

As you can see per error there's one extra quote after "video"" word. Here's my client/lib/semantic-ui/custom.semantic.json file:


{
  "definitions": {
    "accordion": true,
    "ad": true,
    "api": true,
    "breadcrumb": true,
    "button": true,
    "card": true,
    "checkbox": true,
    "colorize": true,
    "comment": true,
    "dimmer": true,
    "divider": true,
    "dropdown": true,
    "feed": true,
    "flag": true,
    "form": true,
    "grid": true,
    "header": true,
    "icon": true,
    "image": true,
    "input": true,
    "item": true,
    "label": true,
    "list": true,
    "loader": true,
    "menu": true,
    "message": true,
    "modal": true,
    "nag": true,
    "popup": true,
    "progress": true,
    "rail": true,
    "rating": true,
    "reset": true,
    "reveal": true,
    "search": true,
    "segment": true,
    "shape": true,
    "sidebar": true,
    "site": true,
    "state": true,
    "statistic": true,
    "step": true,
    "sticky": true,
    "tab": true,
    "table": true,
    "transition": true,
    "video": true,
    "visibility": true,
    "visit": true
  },
  "themes": {
    "amazon": false,
    "basic": false,
    "bookish": false,
    "bootstrap3": false,
    "chubby": false,
    "classic": false,
    "default": false,
    "duo": false,
    "fixed": false,
    "flat": true,
    "github": false,
    "gmail": false,
    "material": false,
    "pulsar": false,
    "raised": false,
    "resetcss": false,
    "round": false,
    "rtl": false,
    "striped": false,
    "timeline": false,
    "twitter": false
  }
}

When I remove "video": true line from config, I'm getting another error:

client/lib/semantic-ui/theme.import.less:17:1: Less compiler error: 'themes/default/globals/site.variables' wasn't found. Tried -
   client/lib/semantic-ui/themes/default/globals/site.variables,/Users/user/project/client/lib/semantic-ui/themes/default/globals/site.variables,/Users/user/project/themes/default/globals/site.variables,themes/default/globals/site.variables

I'm assuming it's happening because themes/default folder doesn't exist anymore, because it's being deleted when I'm setting "default": theme to false

jlukic commented 9 years ago

@flemay

It looks like the project json is out of date. You need to swap video for embed and add container t o component list.

v3rron commented 9 years ago

Ok, it was probably part of the upgrade issue. So I deleted the whole semantic-ui folder and recreated the custom.semantic.json file. Now when I try to switch themes, I still get the error:

Errors prevented startup:                  

   While building the application:
   client/lib/semantic-ui/theme.import.less:17:1: Less compiler error: 'themes/default/globals/site.variables' wasn't found. Tried -
   client/lib/semantic-ui/themes/default/globals/site.variables,/Users/user/project/client/lib/semantic-ui/themes/default/globals/site.variables,/Users/user/project/themes/default/globals/site.variables,themes/default/globals/site.variables

It looks like it's looking for site.variables in the wrong folder. I can see the file in site/globals folder, whereas the error says it's looking for it in themes/default/global which is deleted.

jlukic commented 9 years ago

I'm not sure about how this works with Meteor's pipeline but theme.less includes for site are (optional) and shouldnt produce errors with later versions of LESS. @flemay might have better insight.

v3rron commented 9 years ago

The thing is, those failing lines is not optional. Here's my autogenerated theme.import.less file:

/*
  DO NOT MODIFY - This file has been generated and will be regenerated
  Semantic UI v2.0.0
*/
/*******************************
        Import Directives
*******************************/

@theme : @@element;

/*--------------------
   Site Variables
---------------------*/

/* Default */
@import "@{themesFolder}/default/globals/site.variables";

/* Packaged Theme */
@import (optional) "@{themesFolder}/@{site}/globals/site.variables";

/* Site Theme */
@import (optional) "@{siteFolder}/globals/site.variables.import.less";

/*-------------------
 Component Variables
---------------------*/

/* Default */
@import "@{themesFolder}/default/@{type}s/@{element}.variables";

/* Packaged Theme */
@import "@{themesFolder}/@{theme}/@{type}s/@{element}.variables";

/* Site Theme */
@import (optional) "@{siteFolder}/@{type}s/@{element}.variables.import.less";

/*******************************
             Mix-ins
*******************************/

/*------------------
       Fonts
-------------------*/

.loadFonts() when (@importGoogleFonts) {
  @import url('@{googleProtocol}fonts.googleapis.com/css?family=@{googleFontRequest}');
}

/*------------------
     Overrides
-------------------*/

.loadUIOverrides() {
  @import "@{themesFolder}/@{theme}/@{type}s/@{element}.overrides";
  @import (optional) "@{siteFolder}/@{type}s/@{element}.overrides.import.less";
}

Aren't all the @import lines from default theme should be optional, because there is no more default folder when you switch themes?

jlukic commented 9 years ago

The default theme is always loaded, so that the packaged and site theme only have to specify changed variables (not all of them).

The default theme definitely needs to always be there.

v3rron commented 9 years ago

Ok, so what happens is, the default theme folder is getting deleted once I set "themes" > "default": false

jlukic commented 9 years ago

@flemay Default theme should not be unsettable, since all other themes extend it. Perhaps we should remove from settings?

flemay commented 9 years ago

@jlukic I might add more code to handle this situation or need to clarify in the README :)

pixelpunch commented 9 years ago

The same problem here -

Running Semantic UI v2.1.4 on meteor

Error - 'themes/default/globals/site.variables.import.less' wasn't found.

My settings are - custom.semantic.json - Themes > default:true ; material:true client/themes/material - I don't have any 'default' directory. I have only material/globals/site.variables.import.less - which is present and is OK

Can you please make the instructions more specfic?

nooitaf commented 7 years ago

@pixelpunch you might have forgotten to set the site definition to true.

In essence, this is the most minimal working custom.semantic.json

{
  "definitions": {
    "site": true // <--- needs to be true
  },
  "themes": {
    "basic": true, // <--- a theme
    "default": true // <--- core "theme" needs to be true
  }
}