Results 1 to 2 of 2

Thread: Load json variables in scss with fashion

  1. #1
    Sencha Premium User VDP's Avatar
    Join Date
    Feb 2012
    Location
    Niel, Belgium
    Posts
    101

    Default Load json variables in scss with fashion

    Hi,

    I want to load json variables in the scss. I don't see build in functionality so I thought it would be fairly easy to build an extension since it uses js.

    I started with the js:

    Code:
    exports.init = function(runtime) {	runtime.register({
    		getVars: function () {
    			var vars = require('path/to/vars.json');
    			return vars;
    		}
    	});
    };


    What I did in scss was:

    Code:
    @import "vars.js";
    $vars: getVars()
    $base-color: map-get($vars, 'tertiary-bg');

    my json:

    Code:
    {	"primary-bg": "#FF0000",
    	"secondary-bg": "#00FF00",
    	"tertiary-bg": "lighten(#FF00FF, 60%)"
    }

    What I get is:

    Code:
     Fashion Error : Reference to undeclared variable : $vars :
    Anyone suggestions? How can I get a map out of it or just the plain variables would also be fine.. Or am I looking at it the wrong way? All help is welcome!

  2. #2
    Sencha - Forum Administrator
    Join Date
    Sep 2017
    Posts
    1,005

    Default

    Hi there- I have sent your question over to a team member that can help. They should be getting back with you soon. We appreciate your patience!

Similar Threads

  1. Replies: 2
    Last Post: 9 Dec 2016, 2:13 AM
  2. Replies: 0
    Last Post: 24 Nov 2016, 7:27 AM
  3. Override scss variables inherited down to sub class.
    By sudhanshusekhar27 in forum Ext: Q&A
    Replies: 1
    Last Post: 6 May 2014, 4:13 AM
  4. [FIXED] Hard coded value in variables/_grid.scss
    By droessner in forum Ext:Bugs
    Replies: 1
    Last Post: 6 Mar 2012, 1:26 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •