more efficient writing of multiple properties regarding media query in tailwind css - media-queries

so up until the time of writing ive been doing media query this way
className="text-white text-[1.2rem] lg:text-blue lg:text-[2.5rem]"
are there any methods to write multiple media query properties in "one place" without manually repeating the " lg: " part?
im hoping for something like/close to this
className="lg:{text-blue text-[1.2rem]}"
where properties for the same media query are grouped neatly

tailwindcss by default doesn't support variant groups yet, but you can customize variants. read more
also you can use other libraries like Windi css or Unocss

Unfortunately for now, tailwindcss doesn't support variant groups .
Reference: https://tailwindcss.com/docs/responsive-design

Related

Cro Template as Object

The Scenario
I've been using templates in Cro (documented at https://cro.services/docs/reference/cro-webapp-template), and have enjoyed that there are subs in them.
I currently have a 'main' template, and some reports, let's say report1, report2, and report3.
Let's say that, from report3, I want to include an array of report1.
Now, let's say that the reports each have the following subs:
init: Some Javascript initialisation code (that should only be included once, no matter how many instances of the report are used)
HTML: Some HTML code that should be included for each instance of the report (with a few parameters to differentiate it, but that, due to the restriction of the Javascript framework, may not contain any <script> or <style> tags
data: A snippet of Javascript that again has to be repeated for each time the report is included
Currently I have each of the above in a separate sub in the template.
The Problem
Redeclaration of symbol '&__TEMPLATE_SUB__report-initial'.
The Question
While I can pass a report name (eg. "report1") to the main template, what I'm lacking is a way to have the main template call the subs on the report name that has been passed in, since there may be multiple reports involved.
Ideas I've tried
What would be ideal is if I could somehow create a "report" class that inherits from the template, and pass instances of the template class into the main report, and then call the subs as methods on the report class. However, I've been unable to figure out a way to do this.
I can see three likely options here:
My difficulty may be that I'm not thinking "The Cro Way". If there's a better way to achieve what I'm trying to do, please let me know
There may be a way to achieve what I want, and I've just been unable to understand the documentation (or it may be missing)
While unlikely, it's possible that Cro hasn't been designed with this kind of possibility in mind.
Any help anyone can provide would be appreciated.
Thanks!
Edit: I think a macro that can have multiple (named) "bodies" would solve the problem.
It looks like &__TEMPLATE_SUB__report1-initial is a global that is redeclared when you import report1 into report3. May I suggest to try and use template fragments instead of the whole template?
my initial response to your question is "please can you provide a minimal reproducible example of your code so that we can get a deeper view of the context and have something that we can experiment with"
my current understanding of what you need is "to use raku style classes & objects (with callbacks) in a Cro template setting" - and that the standard ways of doing this such as associative access to a nested topic variable are too limited
in itself, this is not necessarily a weakness of raku / Cro in that the power of a template slang needs to be limited to avoid potential security issues and, as with most template systems, is a bit more prosaic than a full blown coding language
my guess is that Cro template-parts which can chunk up web parts and steps in and out of the (real raku) root block can, depending on how you chunk things up, handle the report data structure that you describe - have you tried this?
if this is still not tenable, there are a couple of ways to expand the options such as dependency injection and route handlers

Clarification needed for Jade Syntax

I'm working with Huge's new Styleguide templates and am starting to wrap my head around Jade syntax. That said, I can't seem to find any documentation related to how the author created image paths. The syntax used is:
img.huge-sidebar__logo.clearfix(src='styleguide/assets/images/#{public.styleguide._data.logoImage}')
The part I'm not getting is the section of the path that appears to be an include:
#{public.styleguide._data.logoImage}
Can anyone shed some light on what this is called and what it's doing?
What you are seeing is an interesting application of Jade's interpolation functionality, which can be used on plaintext strings, such as is the case with src='...'.
It looks different (with the dots) because it's using a multidimensional JavaScript Object rather than simply a variable.

Bootstrap col-span specifications

I have a specification document which states - Bootstrap
Col Spans -2 (.col-span-2). So does that mean I should use col-xs-2 and col-lg-2 while writing the html class names? Or does that mean I should use col-lg-6?
Also, can I use multiple containers in a single bootstrap html page?
span-2 would be col-md-2. By my experience Span was supported in Bootstrap V2.
http://getbootstrap.com/css/#grid look at the Grid Options of the documentation.
Also how come you would like multiple containers? would it not be feasible to use divs?
(Added answer due to unable to comment) Trying to help instead of providing the perfect answer.
Hope this helps.

Trimming the leading THE in SQL results on Joomla module Articles Category

I am trying to trim the leading "the" in a query that returns the titles of articles in Joomla, so that results are displayed in alphabetical order and the leading "the", if present, is disregarded. The module responsible for this is the Article Category (which is Joomla core module) and the file I think I should modify is helper.php in modules/mod_articles_category.
I replace the following line:
$articles->setState('list.direction', $params->get('article_ordering_direction',
'ASC'));
With this:
$articles->setState('list.direction', $params->get('article_ordering_direction',
'TRIM(LEADING \'THE \' FROM a.title) ASC'));
However, if I enable the debug mode, the TRIM is not showing. SO I guess, that I need to make the change somewhere else. Sorry but I am not familiar with Joomla so don't really know where this query is coming from. Any pointer is very much appreciated.
Okay, the short answer is no, I don't believe you can modify a query from a module, just like this. I haven't worked with modules, but I have some experience with components, so I would suggest two approaches:
Try to query the database yourself from the module, not by using setState, but building the query yourself.
You can cheat. Since Joomla has already done the heavy lifting for you, you could just manipulate the result object (i.e. $list) rearranging it and stripping off whatever you don't want. I would also suggest that you treat your code as a layout override, that way you'll be able to update your site without overriding the changes you have made.

How to define more than one stylesheet in adf framework

I am facing a problem with adf skining. My style sheet crossed 1800 classes. IE has a limitation of 4000 style classes. While rendering, ADF adds its own classes. So it crosses 4000 and the styles I am referring at the last of my sheet are not working in IE alone. I need to define a new style sheet for same application.
I have tried adding one more skin-family in adf-faces-config.xml. Did not work.
Please help.
Thanks in advance.
I am not 100% sure if creating a separate CSS will resolve your issue, and I do agree that after being used to multiple css definition and only loading a css for a particular page has its own advantages.
One thing that you can do though is organize the CSS, having 1800 classes might not be the appropriate way to go in a WebApp since a webapp should promote consistency in look and feel.
There is a good discussion in oracle forums that might help you on this, especially on the use of an el expression check on your current view to switch your skin on the fly.
Multiple Skin in the same application
I also mentioned in that forum about using skin-addition as well as my reason on taking up skin addition for our app, even though we didn't get to the number of styleClasses that you have, our css is already hitting 3k lines with only 600 lines for component specific and everything else is styleClass. We've also dramatically used the "inhertance" which trinidad skin offers -tr-inherit this really saved us in a lot of coding.
Use of extends property you can use multiple style sheet for same application.
trinidad-skins.xml
<id>skin_1.desktop</id>
<family>skin_1</family>
<extends>simple.desktop</extends>
<render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id>
<style-sheet-name>css/stylesheet_1.css</style-sheet-name>
</skin>
<skin>
<id>skin_2.desktop</id>
<family>skin_2</family>
<extends>skin_1.desktop</extends>
<render-kit-id>org.apache.myfaces.trinidad.desktop</render-kit-id>
<style-sheet-name>css/stylesheet_2.css</style-sheet-name>
</skin>
in trinidad-config.xml
<trinidad-config xmlns="http://myfaces.apache.org/trinidad/config">
<skin-family>skyros</skin-family>
<skin-version>v1</skin-version>
<skin-family>skin_2</skin-family>
</trinidad-config>