<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nate Steiner on Medium]]></title>
        <description><![CDATA[Stories by Nate Steiner on Medium]]></description>
        <link>https://medium.com/@nsteiner?source=rss-a0255074fe74------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*qOsxdz7BYB2sBblcQy2LEw.jpeg</url>
            <title>Stories by Nate Steiner on Medium</title>
            <link>https://medium.com/@nsteiner?source=rss-a0255074fe74------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 04:20:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nsteiner/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AEM front-end notebook]]></title>
            <link>https://nsteiner.medium.com/aem-front-end-notebook-a97669b34823?source=rss-a0255074fe74------2</link>
            <guid isPermaLink="false">https://medium.com/p/a97669b34823</guid>
            <category><![CDATA[aem]]></category>
            <category><![CDATA[gulp]]></category>
            <category><![CDATA[scss]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Nate Steiner]]></dc:creator>
            <pubDate>Wed, 17 Oct 2018 16:15:51 GMT</pubDate>
            <atom:updated>2021-02-23T14:25:42.028Z</atom:updated>
            <content:encoded><![CDATA[<p>This post is a grab-bag of various tips and tricks I’ve learned along the way (or have searched for and found the answers). This is not in any particular order, it’s also a work-in-progress so I’ll add more as I go.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HEGD0Bbfrn_QOdQ1g4pHkw.jpeg" /></figure><h3>Override link checker for particular links</h3><p>So you don’t get those chain icons showing broken links for special cases. Two ways to do it, in both cases just add these to the anchor tag in your template, they won’t be rendered in the final HTML output: x-cq-linkchecker=”valid” or x-cq-linkchecker=”skip”</p><h3>Store images/fonts in clientlib in a way that can be accessed</h3><p>Use the folder name resources store fonts and other assets that you want to access via your clientlib. But in general it’s better to keep images editable and stored in the DAM so they can be modified without code changes.</p><h3>Process SCSS/SASS to CSS in minimal and AEM friendly way</h3><p>There’s a million ways to do this. You can use a more feature-rich webpack approach, but if you just want to slightly improve AEM’s built in LESS processing feature, then you can have Gulp process SCSS files inline (create CSS output wherever the SCSS file is found). Here’s a gist for how I do that: <a href="https://gist.github.com/nsteiner/d262df03ecf0cac020136d4c34f2a165">https://gist.github.com/nsteiner/d262df03ecf0cac020136d4c34f2a165</a></p><p>Features of this method: inline sourcemap generation, autoprefixing, and SASS processing. That’s it. 🙂</p><p>Usage: Put the package and gulpfile in the root dir (or elsewhere if you prefer) and run npm install to get the dependencies. Then either run gulp whenever you want to, or fold it into maven or a build script. The big win with this method is that it’s very hands-off, so you can put your SCSS files (and CSS output) wherever it makes sense to within your clientlib folders.</p><h3>Recompiling old AEM JSPs</h3><p>On older AEM installs you sometimes have to recompile JSPs to clear errors and see updates. There’s a special URL you can use to access a button for clearing: <a href="http://localhost:4502/system/console/slingjsp">http://localhost:4502/system/console/slingjsp</a></p><p>This page should have a “Recompile all JSPs” button it, click and retest.</p><h3>Unwrapping AEM component wrappers</h3><p>AEM will add wrapper DIV tags with classnames to your components, and usually that’s a good thing (for the admin UI purposes). If you need to remove it, you can add this to the component’s .content.xml file: cq:noDecoration=”{Boolean}true”</p><h3>Customizing AEM component wrappers</h3><p>Removing the component wrapper as described above can be problematic for the admin UI. If you just want to ensure that some class names are added to it, you can add a node to configure this. One way to do that is to add this within the jcr:root tag of .content.xml file for the component:</p><pre>&lt;cq:htmlTag<br>        jcr:primaryType=&quot;nt:unstructured&quot;<br>        class=&quot;my_important_class another_class&quot; /&gt;</pre><p>This seems to work better for for nested components especially.</p><h3>AEM CSS class names you may want to avoid</h3><p>AEM generally gives you the tools to produce HTML markup the way you want, and usually scopes it’s own styles nicely (e.g. .cq-Editable-dom) but here are some classnames you might want to avoid, just in case. I’ll add to this list if I find more.</p><ul><li>.section</li><li>.page</li></ul><h3>Avoiding zero height parsys and other weird artifacts of a half-working touch-ui edit mode experience</h3><p>If you’ve started from nearly scratch and are being very selective about what AEM code is surfaced client-side, you’ll want to ensure that the “init” component is included, perhaps on the main page component itself. Not having this will cause a bunch of problems for the edit mode interface.</p><pre>&lt;sly data-sly-include=&quot;/libs/wcm/core/components/init/init.jsp&quot;/&gt;</pre><h3>Searching the content</h3><p>A common scenario occurs after pages or chunks of content are established, you’ll need to find out how many times a component is used in a site, or how many pages were generated by way of a specific template. You can use SQL to search for these types of things in CRX/DE by using the query tool, choose SQL2 if you’re using the examples below.</p><p><em>Example Below: searching for all pages made with a specific template</em></p><pre>SELECT * FROM [nt:unstructured] AS page WHERE ISDESCENDANTNODE(page, &quot;/content/project_name/en&quot;) AND [cq:template] = &quot;/apps/project_name/templates/template_name&quot;</pre><p><em>Example Below: same as pervious example but adding a filter for nodes made before a certain date</em></p><pre>SELECT * FROM [nt:unstructured] AS page WHERE ISDESCENDANTNODE(page, &quot;/content/project_name/en&quot;) AND ([cq:template] = &quot;/apps/project_name/templates/template_name&quot;) AND ([jcr:created]  &lt; &#39;2019-01-30T00:25:12.687Z&#39;)</pre><h3>Self-close IMG tags</h3><p>Image tags in HTL with data-sly-test in them, seem to work as expected only when they are self-closed in the old XHTML style &lt;img src=&quot;foo.jpg&quot; /&gt;</p><h3>Heading in a dialog</h3><p>Sometimes it’s helpful to add a heading inside your dialogs, here’s how to do that. The tag name dialogHeading in the example below is arbitrary.</p><pre>&lt;dialogHeading<br> jcr:primaryType=&quot;nt:unstructured&quot; <br> sling:resourceType=&quot;granite/ui/components/coral/foundation/heading&quot;<br> level=&quot;3&quot;<br> text=&quot;My Heading&quot;/&gt;</pre><h3>Pulling one component into another</h3><p>In order to get a fully editable component inside another one, you need to both declare a new node path (just a name in this case) and also point to the component using the resourceType attribute.</p><pre>&lt;sly data-sly-resource=&quot;${ @ path=&#39;mySpecialNodeName&#39;, resourceType=&#39;project/path/to/components/componentName&#39;}&quot; /&gt;</pre><p>Other options include:</p><ul><li>create a par, so authors can drag in the component(s)</li><li>if authoring isn’t needed, use an include to the file inside the component (start from /apps/ in this case)</li></ul><h3>Using Numbers</h3><p>In AEM, adding a numberfield to your dialog does not generate a number, it generates a string. This can be confusing when you want to use the value later for comparison. For example, if you have a long list of items, and you want the author to be able to limit how many are shown. Using data-sly-test will fail because you can’t compare the number of items in a list against a string. To fix, you can adjust the value of your field to a number using @typehint which (when used in the dialog) ends up being a little extra hidden node you add.</p><p>So if you had a numberfield in your dialog named maxItems then you’d add this underneath it:</p><pre>&lt;maxItemsTypeHint</pre><pre>jcr:primaryType=&quot;nt:unstructured&quot;</pre><pre>sling:resourceType=&quot;granite/ui/components/foundation/form/hidden&quot;</pre><pre>ignoreData=&quot;{Boolean}true&quot;</pre><pre>name=&quot;./maxItems@TypeHint&quot;</pre><pre>value=&quot;Decimal&quot;/&gt;</pre><p>The important pieces here are that you use the ignoreData attribute on this new hint node, and that you reference the field you want to use in the name, and add @TypeHint to the end of it. There are other field types, but in this case, we want Decimal</p><h3>What happened to my footer? Or: Authoring has a bug with viewport height CSS</h3><p>If you find that in author mode your page keeps growing in height, it may be because of a bug where use of viewport height CSS is misunderstood by the authoring environment. You can work around this by providing alternate CSS for the authoring context. One option would be to overwrite the VH style with an author-only clientlib. Another option is to provide yourself a utility class so we know when the authoring environment is in use.</p><pre>&lt;sly data-sly-test.author=&quot;${wcmmode.edit || wcmmode.preview || wcmmode.design}&quot;&gt;&lt;/sly&gt;</pre><pre>&lt;body class=&quot;${author ? &#39;wcmmode&#39;:&#39;&#39; @ context = &#39;attribute&#39;}&quot;&gt;</pre><p>Then you can use your new .wcmmode class as part of a stronger selector.</p><h3>Identify a component instance in a page</h3><p>You can use the component’s node name, it should be unique. This is probably not suitable for all cases (I think weird names are possible), but when you add a second instance of a component, it will automatically get a unique node name. As in myComponent will get myComponent_copy or something similar depending on how it was created. If you need that unique id, you can reference it with:</p><pre>${resource.name}</pre><p>Another option would be to create a field for authoring a unique slug. This is also not foolproof as authors could miss-use this.</p><h3>Make use of the total number of items in a list for simple cutoffs in HTL alone</h3><p>Unfortunately there’s no ${itemList.total} but if you need to, for example, render a button when there’s more than 4 items — you can do this type of logic with:</p><pre>&lt;sly data-sly-list=&quot;${whatever}&quot;&gt;<br>  &lt;sly data-sly-test.showButtonForMore=&quot;${itemList.last &amp;&amp; itemList.count &gt; 4}&quot;/&gt;<br>&lt;/sly&gt;<br>&lt;button data-sly-test=&quot;${showButtonForMore}&quot;&gt;More Items&lt;/button&gt;</pre><h3>More…</h3><p>More tidbits will be put in here over time. I update this page pretty frequently.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a97669b34823" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DIY Bold Protest Signs]]></title>
            <link>https://nsteiner.medium.com/diy-bold-protest-signs-e03bbdcf5f81?source=rss-a0255074fe74------2</link>
            <guid isPermaLink="false">https://medium.com/p/e03bbdcf5f81</guid>
            <category><![CDATA[signs]]></category>
            <category><![CDATA[protest]]></category>
            <category><![CDATA[resist]]></category>
            <dc:creator><![CDATA[Nate Steiner]]></dc:creator>
            <pubDate>Sun, 29 Jan 2017 20:28:58 GMT</pubDate>
            <atom:updated>2017-01-29T20:44:41.926Z</atom:updated>
            <content:encoded><![CDATA[<h4>If you want to create bold signage for your weekly 2017 protest needs, here’s an easy way to put them together.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1XhlDbQU-9lOT2yrOadz6w.jpeg" /><figcaption>Photo of Atlanta Women’s March, by<a href="https://flic.kr/p/RrvjPi"> Alan Sandercock</a></figcaption></figure><h3>What you’ll need</h3><ul><li>Adobe Illustrator*</li><li>Paper cutter</li><li>Printer</li><li>Standard foam core board</li><li>Spray mount</li></ul><p>Most foam core board you get a grocery store is a fine size for protesting. It’s usually 28&quot; wide by 22&quot; high, make note if yours is a different size. Open up Illustrator and create a document using the sizes (in inches) to match your board.</p><p>What you put on your sign is the fun creative part. I recommend big bold typefaces, and keeping the messaging short, to the point, and unmistakably clear. Keep in mind that this will be viewed from a distance, so simpler is better.</p><p>If you don’t like the fonts you have to choose from on your computer, there are a bunch of bold display fonts <a href="https://fonts.google.com/?category=Sans+Serif,Display&amp;thickness=8">available for free from google</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rDrqPYT2mD-8RLfIKtNznw.png" /></figure><p>Print using Illustrator’s dialog and set “Scaling” to “Tile Imageable Areas.” This is the magic that saves you lots of time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*CXtAzchcoPszECJQVangdQ.png" /></figure><p>This will print out 9 pages. Each will have a standard edge where the printer can’t reach (usually around 1/4 inch). Use the paper cutter to trim that off (you can trim the entire stack at once).</p><p>Line up your paper on the board, you’ll see that there’s about 1 1/4 inch of extra paper around the edges, this is ok, you can trim it off later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*agfuGEUXCGFbemqy-dxEzA.jpeg" /></figure><p>Take the board and papers outside, spray the board, then spray the back of each paper and place it as you did before.</p><p>After they are all placed, flip the board over and trim off the excess paper with a blade or scissors.</p><p>Repeat for the back side if you like. You’re done!</p><p>*<em>I realize that not everyone has Adobe Illustrator, and that it’s rather expensive. I’m describing it because it’s just what I happen to have. If someone knows of an application that will do easy print tiling like this, but doesn’t cost an arm and a leg, send me a link and I’ll add it here.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e03bbdcf5f81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SCSS anti-patterns]]></title>
            <link>https://nsteiner.medium.com/scss-anti-patterns-22a6f0d7edb9?source=rss-a0255074fe74------2</link>
            <guid isPermaLink="false">https://medium.com/p/22a6f0d7edb9</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[css]]></category>
            <category><![CDATA[scss]]></category>
            <dc:creator><![CDATA[Nate Steiner]]></dc:creator>
            <pubDate>Tue, 10 May 2016 14:27:31 GMT</pubDate>
            <atom:updated>2016-05-10T14:27:31.019Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m very much in favor of CSS processing (pre and post) as a useful tool for most front-end development. I’ve used it enough to recognize in retrospect the ways in which mixins and variables can become problematic. Hindsight is 20/20.</p><h4>General philosophy</h4><p>CSS is human readable unto itself; clean, documented and organized CSS even more so. So what are the justifications for using a mixin or variable to begin with?</p><ol><li>Simpler input is processed into more complex output</li><li>Commonly repeated patterns turned into a typing shortcut</li><li>Memory enhancement (don’t have to remember syntax)</li><li>Equalizing a CSS pattern so it can be modified globally</li></ol><p>Note that these are mostly aiding the developers who understand them fully and use them regularly. People new to the codebase will at least initially have more work to do, parsing what the various mixins are used for, and what code they are generating. With maybe the exception of (4), none of these improve the code quality.</p><p>This points to a general anti-pattern of processing overuse. Have you abstracted your CSS so it’s harder for new developers to participate in? Is the output generated now much more verbose than if you had written it directly? Is your code bloated because mixins are being used as a crutch for CSS knowledge?</p><h4>Anti-patterns in the wild</h4><p>Here are some of the anti-patterns I’ve noticed (and/or created 😳) in the past. A gist of code samples with the same names follow.</p><p><strong>Abstracted away from clarity</strong></p><p>In this case you’ve saved yourself a tiny bit of typing, but you’ve abstracted your CSS and so you’ll need to reference the mixin unless you’ve memorized the order of variables.</p><p><strong>Abstraction without processing</strong></p><p>This is just hiding CSS, and also forces developers new to your code to reference two places to understand it.</p><p><strong>Better handled by Post-CSS</strong></p><p>Before we had Post-CSS, a lot of mixins existed simply to handle browser-specific compatibility flags (-webkit etc). Post processing, such as with Auto-prefixer, can take standard well-formed and readable CSS and enhance it with backwards compatibility-enhancing prefixes and syntax after the fact. Maintaining backwards-compatiblity with Post-CSS is preferable from a code readability and comprehension standpoint, as long as the output is checked and the auto-prefixer configuration is maintained.</p><p><strong>Overly specific variable</strong></p><p>Efficient variable usage is a matter of optimizing the types of values that should be unified and consolidated. Variables are very useful for things like brand colors, especially in template sets that will exist with multiple themes. Overly specific variables are more than likely an indicator of structural inefficiencies. If a variable is so specific that you’d never change it, then it probably shouldn’t be a variable.</p><p><strong>Useless variable</strong></p><p>A variable that describes it’s own placement and value is a “shortcut” without any benefit. If the value was changed, this would become incredibly misleading.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0bc59c304ad0d9b28073c2f672ab427d/href">https://medium.com/media/0bc59c304ad0d9b28073c2f672ab427d/href</a></iframe><h4>There’s probably more</h4><p>I can only imagine what other anti-patterns are out there. The challenge with any powerfully useful technology is to use it responsibly.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22a6f0d7edb9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>