What Sass means by "@function rules may not contain style rules."
When writing a Sass function, you may run into an error message that may be confusing:
@function rules may not contain style rules.
What Sass is trying to tell you is that a line in your Sass function is computing a result that is neither assigned to a variable nor returned.
Keep in mind that all functions in Sass return something, Sass does not mutate objects.
Related cards:
What we know about PDFKit
What PDFKit is
- PDFKit converts a web page to a PDF document. It uses a Webkit engine under the hood.
- For you as a web developer this means you can keep using the technology you are familar wit...
Some tips for upgrading Bootstrap from 3 to 4
Recently I made an upgrade from Bootstrap 3 to Bootstrap 4 in a bigger project. Here are some tips how to plan and perform such an upgrade. The effort will scale with the size of the project and its structure. If your stylesheets already follow st...
A simpler default controller implementation
Rails has always included a scaffold
script that generates a default controller implementation for you. Unfortunately that generated controller is unnecessarily verbose.
When we take over Rails projects from other teams, we often find that cont...
Render Sass stylesheets dynamically
If - for whatever reason - you have to render stylesheets dynamically, the following snippet might be of help. It emulates what "sprockets" would to when precompiling your assets, and give your stylesheets access to all the regular bells and whist...
Delivering Carrierwave attachments to authorized users only
Preparation
To attach files to your records, you will need a new database column representing the filename of the file. To do this, add a new migration (rails g migration <name>
) with the following content:
class AddAttachmentToNotes...
JavaScript without jQuery (presentation from 2019-01-21)
Summary
- We want to move away from jQuery in future projects
- Motivations are performance, bundle size and general trends for the web platform.
- The native DOM API is much nicer than it used to be, and we can polyfill the missing pieces
- Un...
Ruby: A small summary of what return, break and next means for blocks
Summary
- Use
return
to return from a method.return
accepts a value that will be the return value of the method call. - Use
break
to quit from a block and from the method that yielded to the block.break
accepts a value that suppl...
MySQL: How to create columns like "bigint" or "longtext" in Rails migrations, and what :limit means for column migrations
Rails understands a :limit
options when you create columns in a migration. Its meaning depends on the column type, and sometimes the supplied value.
[The documentation](http://apidock.com/rails/ActiveRecord/ConnectionAdapters/TableDefinition/co...
Solved: Element inside overflow:scroll container cannot be scrolled on iOS when dragged by a contained iframe
Imagine the following HTML structure, where the scrolling container has overflow-y: scroll
:
+--scrolling container+-+
| |
| +-child element+----+ |
| | ++iframe++ | |
| | | | | |
| | | |...
When Sass-generated stylesheets print a Encoding::CompatibilityError
We upgraded a Rails 2 application to Rails 3.2 and Ruby 2.1, changed the mysql adapter from mysql
to mysql2
, but did not activitate the asset pipeline. Instead we used Sass the old-school way (stylesheets in public/sass/*.sass
) and relied on...