Jump to content

Recommended Posts

Hello,

 

it would be of great benefit having a CSS preprocessor instead of working with pure CSS. Where I can define some variables, e.g. color, corner radius, border style, ... and can reuse it. without searching and replacing every line.

Like LESS or SASS.

 

In my case, I am not an designer. For developing I just use some simple css styles, in order it works. But later I would like to finetune my appearance, in order it looks more prefessional. So, when I always have to find replace all my values, it would take ages and is very error prone, because sometimes a special setting should not be replaced.

 

It's like working with constants in code, instead of hardcoded values. Otherwise, maintaing would become a nightmare.

Link to post
Share on other sites

Currently there is already a CSS preprocessor built into Smart Mobile Studio. It is based on DWScript and it is partially already used. Have a look at the Android-Holo.css file for a basic example.

 

If you like you can script the entire CSS file in DWScript's Object Pascal. To start writing code in Pascal just add

<?pas
...
?>
 

and replace '...' with any Pascal code.

 

If you write something like

<?pas=...?>;
it is automatically translated to 

<?pas 
PrintLn(...)
?>
again where '...' is your code.

 

So for example you can write something like this:

<?pas
const colBackground = $BADF00D
?>

html, body {
    background-color: <?pas=colBackground?>;
}

.TW3Form {
    background: <?pas=colBackground?>;
}
With this code you can use the same background color in two different spots.
Link to post
Share on other sites

My question is not about CSS but about default.html (project template html file).

PreProcessor here supports few keywords, like Project.Title, I'm wondering how to access HomePage url specified for project or other fields or settings that are configurable for the project, is there a list of all allowed builtIn keywords that can be used in template script?

Link to post
Share on other sites

Currently there is no such list. It would be indeed nice to have one. Also template interface is far from being complete. It would be nice to have it completed.

 

What has been done is that the templates can also be used for Node.js projects. Only with this it's possible to write Node.js command-line scripts.

 

From what I can see it only supports 'Title', 'Options', 'MetaData' and 'Version' at the moment. The 'MetaData' object contains a fields for 'Author', 'Company', 'Description', 'Keyword', 'Notes' and 'URL'. The latter should give you the HomePage url.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...