Using SCSS/SASS with Dojotoolkit - sass

Is there a way to use sass/scss with Dojotoolkit ?
I've searched for any documentation, tutorial or references but couldn't find any.

It depends on what you really need to do.
Generally Dojo Themes like Claro are based on LESS CSS preprocessor, Dojo Flat instead use Stylus.
So if you need to modify or fork Dojo Themes you should stick to LESS or Stylus.
If instead you do not need to modify a Dojo Themes and just simply need add your CSS for anything else you could use with no problem SCSS/SASS.
I would suggest in that case to process your styles using a separate "tasks", example you could use gulp-sass or similar.

Related

How to remove modules not used in quilljs

We are using Quill for basic formatting (Bold, Italic, Link, BlockQuote). However Quill.min.js is the largest file that we've in our page.
We are looking to cut the size of the file by including the necessary modules only (for e.g. remove Syntax and Formula).
What is the way to get them removed? Do we need to setup the environment as described in Development page? Would it be possible to comment or remove the codes in quill.js? Appreciate any guidance
You can use quill.core.js and quill.core.css instead which will not have extra modules like Syntax and Formula. These files are not minified for you however. If you want to customize further then you will have to build Quill yourself.

Use Grunt to make DOM changes

So I want to use Lazysizes (lazy loading responsive images). Included in my Grunt stack is Responsive Images Extender, which outputs responsive image code (srcset) from simply including an "img" tag with a "src" attribute. Lazysizes requires the "data-srcset" attribute in replace of the "srcset" attribute, however. I added a script to my page that changes the "srcset" attributes to "data-srcset" attributes, but this isn't ideal as images are are already downloaded at runtime. It would be ideal if I could change the tags with Grunt, as there is no advantage in changing them live.
This seems like a very common thing, but I cannot find a good way to do it. String replace doesn't seem like an ideal solution, since it can cause problems if I ever use "srcset=" in my code.
I gave the grunt-responsive-images-extender a major makeover and added the possibility to change the attribute name of srcset to anything you want (data-srcset in your case) via the srcsetAttributeName option.
There is a grunt tans called dom_munger. With dom_munger you can change HTML attributes and do a lot of interesting stuff; however I cannot find a way to change an attribute name to another thing. Perhapse you can have a better luck checking it.

Magento Javascript merge - why does it break in some cases?

Okay I've been doing JS merges for some time now and still can't figure out the logic behind making a successful merge. It comes down to repositioning libraries upwards and downwars on merge list. Sometimes jquery must be on top, sometimes it doesn't. Sometimes fancybox needs to be added as addJs, sometimes as addItem.
So, what is in your experience causing JS libraries to break when you use Magento's merge JS? Are there any rules for sucessful merge?
UPDATE: Just now in my local.xml I moved from
<action method="addItem"><type>skin_js</type><name>js/magiczoomplus.js</name></action>
to
<action method="addJs"><script>jquery/magiczoomplus.js</script></action>
and that solved the magiczoomplus error I was getting on the page. How so?
I'm trying to understand this problem so I can better tackle it in the future
you need to understand the core principle here what conflicts between javascript libraries and what not.
in case of jQuery and Prototype conflict and in Magento:
always include jQuery before any other script on your page , before Prototype is a must
add jQuery.noConflict(); call directly to the end of your jQuery library file
make sure that none of your jQuery based scripts are not using $ as method name (essence of the conflict here)
If there are any problems after Javascript merging is enabled, I always tried to replace minimized Javascript files with non-minimized versions of those files. And it always solved the problems. (I don't know why there are problems with minimized files)
Not alot of options to actually fix merging but
1.) Use group-ing in your local.xml files to ensure a better merge.
http://fishpig.co.uk/blog/why-you-shouldnt-merge-javascript-in-magento.html
2.) Abandon Magento's built-in merging altogether and use Fooman_Speedster instead.
http://www.magentocommerce.com/magento-connect/fooman-speedster.html
The second one has worked perfectly for me so far. I'm using jQuery libraries and even more (Handlebars, etc) and i'm having no problems whatsoever.
What worked for me was moving the jQuery include after prototype and adding jQuery.noConflict(); after the jQuery include.
What works for me after all this time, is:
Always putting jQuery on top, followed by noConflict
Toggling between compressed and uncompressed version of included JS (if you enable gzip compression you should not be worried about the final size - it will be compressed one way or another)
Toggling between addItem and addJs inclusion methods
Randomly repositioning erroring libraries

TinyMCE: Automatic add style attribute on link creation

In TinyMCE, I need to add a in-line style attribute on link creation. The reason is that Google Mail doesn't support tags in a newsletter.
One solution can be "advlink". But who would explain to our user...that he must add css code in a new link...bad solution.
There must be a simpler, user-friendly way, but i can't find it. Is there an option that i can tell the plugin to add automatic style-attributes to a link?
//EDIT
Ok, i think another solution can be, if i can add anchor to 'style_formats'. But an anchor is not supported in 'style_formats'...someone has an idea?
You may write an own plugin which adds the inline style element to links.
An easier approch is to put the necessary code into the setup config paramter.

MVC Framework - Server-side DOM manipulation

I'm building an MVC framework, and I'm looking for native solutions / frameworks / tag libraries to draw from or to replace my framework entirely.
I'm interested in the following features specifically:
server-side DOM manipulation
server-side events (page reload, form submit, node insertion, etc.)
traversing the DOM tree using css selectors
validation of html nodes nesting
validation of html nodes allowed attributes
support for tag libraries / user controls
Pretty much what you get with JavaScript, but on the server-side and with some little extras.
Any solution will do (even if partial), any language will do, any pointers are appreaciated (even from client-side languages, as long as it's possible to check the source code). Dealing with malformed html is not a prerequisite. Outputting valid markup is a big plus.
Please offer practical solutions by pointing the language/framework that is being discussed and, if possible, what features it provides.
have you checked out aptana jaxer?
If you load your page into a DOM-parser you would be able to modify it from there. Then outputting it to the output buffer seems trivial.
But you would need to store the entire document in memory, which will inflict on the performance.
So, jQuery has a sort of selectors API implemented, I guess I can take a look at their source code. Also, PHP has support for XPath, this could help too.
Found a php html dom parser that also implements some html selectors here: http://simplehtmldom.sourceforge.net
Fizzler uses HTMLAgility pack and adds a server side queryselectorall to provide css selection: http://code.google.com/p/fizzler/
Maybe you are looking for ItsNat

Resources