SASS enable?

Game development with Board Game Arena Studio
Post Reply
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

SASS enable?

Post by Rudolf »

Hello, I tried to use SASS ( especially variables and loop) in TPL, also in CSS... but cannot work.
Is Ruby available on server?

I would like to be able to use Background modification (delta) with class

bkp_1 {background-position:-170px -170px;}
.bkp_2 {background-position:-170px -193px;}
.bkp_3 {background-position:-170px -277px;}
.bkp_4 {background-position:-240px -277px;}
...
.bkp_13 ....

I give some objects the class bkp_1, another bkp_2, and so on.... and I would like add a relative amount to background position via a class, for example
.bkp_mod {delta.background-position: -360px 0px}

Then if I give class bkp_3 and bkp_mod to an object, I would like it gives -530px -277px (ie:-170px -360px = -530px)
I was adviced that SASS could help me doing that, Is this right?
and I was wondering if I could use it...
it seems to need ruby installed, so maybe it's done?
this is usefull with dojo.query ... to modify a style of cards for example.
User avatar
Coin-coin le Canapin
Posts: 163
Joined: 31 January 2013, 19:00

Re: SASS enable?

Post by Coin-coin le Canapin »

If your values are a multiple of a fixed value you can generate your classes with SASS but you should compile your sass file to a css file locally then upload the css on BGA server.
If the purpose is having a CSS sprite I guess you can use an online generator, you can find a lot on the internet, but they won't be able to create the secondary class you mention which adds or decreases the background position.

I can take a look at your issue if you give me more info. :)
User avatar
pikiou
Posts: 389
Joined: 03 October 2011, 05:36

Re: SASS enable?

Post by pikiou »

Another solution would be to directly set the background-position CSS property from your JS script. It's what the Stock JS component does for you (documentation on the Studio homepage).
I wrote my own scripts to handle sprites and it's what they do: setSprite(HTMLelement, spriteName, spriteId=0) or something.
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

Re: SASS enable?

Post by Rudolf »

Thanks, I know how to manage this with Js.
But I would like to keep coding with actual method. next game, maybe I change.
I use addclass and removeclass for setting sprite and I will stay with this.
I thought there was a simply thing to make a delta direct, but it's not the case, nevermind, the goal was to keep room in css. If I generate it with an automate, finally it does not change anything: the size will be same... I thought there was a way to loop managed by the browser.
Nevermind, for 18 other class, I will write this directly in the CSS adding the extension in the name as I did for the other ;)
User avatar
Coin-coin le Canapin
Posts: 163
Joined: 31 January 2013, 19:00

Re: SASS enable?

Post by Coin-coin le Canapin »

How big would be your css ? Does your classes take that much space ?
User avatar
Rudolf
Posts: 566
Joined: 24 December 2011, 23:04

Re: SASS enable?

Post by Rudolf »

it was just a way of not doing a repetitive work ;)
Post Reply

Return to “Developers”