Webpack builds can take a long time, so we only want to compile when needed. This card shows what will...
When you need the DOM node of a tag (e.g. to read extra attributes, or to modify the DOM near it), you can usually reference it via document.currentScript. However, document.currentScript is unsupported in ancient browsers, like Internet Explorer 11 or wkhtmltopdf's Webkit engine. If you are not running async scripts, you can easily polyfill it: document.scripts[document.scripts.length - 1] It works because document.scripts grows with each tag that was evaluated. That is also the reason why this solution will not work reliably for async code. Demo: https://codepen.io/foobear/pen/poRLxQm
To attach files to your records, you will need a new database column representing the filename of the file...
When your Rails application server raises error, Capybara will fail your test when it clears the session after the last...
Browsers blocks abusable JavaScript API calls until the user has interacted with the document. Examples would be opening new tab...
In Ruby (almost) everything is an Object. While this enables a lot of powerful features, this concept might be confusing...
capybara-lockstep can help you with flaky end-to-end tests: This Ruby gem synchronizes Capybara commands with client-side...
json is part of the standard library of Ruby and deals with JSON, obviously. As you know, JSON is the...
When you repeat a subpattern with a *, + or {...} operator, you may choose between greedy, lazy and possessive modes. Switching modes...
Recently I made an upgrade from Bootstrap 3 to Bootstrap 4 in a bigger project. Here are some tips how...
Rails 6 includes a WYSIWYG editor, Action Text. It works out of the box quite well, but chances are that...
TinyMCE is a WYSIWYG editor which is quite customizable. Add a custom button to the tinyMCE toolbar and tell tinyMCE...
Using Ruby 1.8.7 you will not be able to use the maximum versions Rubygems 1.8.30 and Bundler 1.17.3 with https://...
Feature Queries (Edge 12+): Similar to @media queries, @supports blocks can be scoped to browsers that support a given declaration...
When deploying a Rails application that is using Webpacker and Capistrano, there are a few configuration tweaks that optimize the...
This card is mainly an explanation how variable fonts work in CSS, not necessarily a recommendation to actually use them...
Scroll and touch event listeners tend to be computationally expensive as they are triggered very often. Every time the event...
We currently test most of our gems on Travis CI, but want to migrate those tests to Github Actions. This...
Google Chrome disables Notifications for insecure origins (i.e. those using HTTP). Only http://localhost is considered secure.
You can do this per environment, e.g. in config/webpack/test.js: const environment = require('./environment') const config = environment.toWebpackConfig() config.devtool = 'none' module.exports = config
We structure our CSS using the BEM pattern. Our naming convention for blocks, elements and modifiers has evolved over the...
If you migrate a Rails application from Sprockets to Webpack(er), you can either transpile your CoffeeScript files to JavaScript...
CSP hat zum Ziel einen Browser-seitigen Mechanismus zu schaffen um einige Angriffe auf Webseiten zu verhindern, hauptsächlich XSS...
"Open-source software (OSS) is great. Anyone can use virtually any open-source code in their projects." Well, it depends...