Serg Hospodarets Blog

Serg Hospodarets blog

Front-End frontiers
Serg Hospodarets
Passing data from Sass to JavaScript: sass-to-js

The idea

Once I needed to add component to show controls like the following: control

The number of sections in it had to be configurable. To do it usually you can add two config variables: one in Sass, one in JavaScript.

But I wanted to have config only in one place and reuse it in the second. That’s how the idea to pass data from Sass to JavaScript came to me.

Demo

...
Read full post  >
Track JavaScript, AngularJS and jQuery errors with Google Analytics

Google Analytics is the most popular website statistics service. It is used for many purposes: from tracking visitors and sessions to campaigns and events.

Ability to track any events provides us possibility to send and track any data in Google Analytics. One of the most useful in that case for web developers might be errors analytics.

So far Google proposes 2 ways of tracking events:

  1. Classic ga.js with the for tracking like _gaq.push(...)
  2. Newer analytics.js has syntax ga('send', ...) and is part of the new Universal Analytics

Let’s provide JavaScript, AngularJS and jQuery errors checking.

...
Read full post  >