Matching multiple BEM modifiers in Sass

https://stackoverflow.com/questions/47652849/matching-multiple-bem-modifiers-in-sass

https://jsfiddle.net/urjehcn7/2/

 

Advertisements

Egghead Useful Free JavaScript Videos

https://egghead.io/courses/just-enough-functional-programming-in-javascript

https://egghead.io/lessons/javascript-queue-data-structure-in-javascript

https://egghead.io/lessons/javascript-introduction-to-algorithms-in-javascript

https://egghead.io/courses/javascript-promises-in-depth

https://egghead.io/courses/algorithms-in-javascript

https://egghead.io/search?query=javascript

configure eslint in project using webpack

First, you need webpack installed in your project and later go through this https://webpack.js.org/loaders/eslint-loader/

Learn ESLint basics from very nice video tutorials by Andrew Mead

Configuring ESLint: https://eslint.org/docs/user-guide/configuring

Steps:

1. Create project using webpack.

2. Install loaders..

3. Set rules

4. Update package.json with lint scripts.

That’s it. You are done :).

Install

$ npm install eslint-loader --save-dev

NOTE: You also need to install eslint from npm, if you haven’t already:

$ npm install eslint --save-dev

Usage

In your webpack configuration

module.exports = {
  // ...
  module: {
    rules: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
https://medium.com/dailyjs/adding-eslint-to-your-project-7bd4feca35a8
        loader: "eslint-loader",
        options: {
          // eslint options (if necessary)
        }
      }
    ]
  }
  // ...
};

ESLint Rules, Best Practices of AirBnb:
https://github.com/airbnb/javascript/tree/master/packages/eslint-config-airbnb-base/rules

https://eslint.org/docs/user-guide/command-line-interface

References:

https://flaviocopes.com/eslint/#airbnb-style-guide

https://www.learnhowtoprogram.com/react/react-fundamentals/building-an-environment-automatic-linting-with-webpack

check this

For more check this commit.

Convert font icons to SVG Sprite Image

Today we will be converting font icons to SVG Sprite Image..

If you ask me how at this moment? i will say i don’t know :). Even i have to explore, learn and implement it.

Where we can get SVG icons?

https://icomoon.io/app/#/select

https://thenounproject.com/

https://iconmonstr.com

https://www.flaticon.com/

From the reference from this article, i am able to generate SVG Sprite from SVG’s and applied my own css on top of it.

npm install and include SVG sprite loader:

$ npm install svg-sprite-loader --save-dev

const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');

Next, you’ll need to add a loader to handle your .svg icons:

Your full webpack config should look something like this:

const webpack = require('webpack')
const SpriteLoaderPlugin = require('svg-sprite-loader/plugin');

module.exports = {
  entry: {
    main: './public/src/js/main.js',
  },
  output: {
    filename: './public/dist/js/[name].js'
  },
  module: {
    loaders: [{
      test: /icons\/.*\.svg$/,
      loader: 'svg-sprite-loader',
      options: {
        extract: true,
        spriteFilename: './public/dist/img/icons.svg',
        runtimeCompat: true
      }
    }]
  },
  plugins: [
    new SpriteLoaderPlugin({
      plainSprite: true
    })
  ]
};

Now that Webpack is configured to handle your icons, you’ll need to import each of them into your JS. You could do this manually, but to automate the process, you can use the helper function below to import them automatically.

function requireAll(r) {
  r.keys().forEach(r);
}

requireAll(require.context('../path-to-icons/', true, /\.svg$/));

Run webpack and a new file called icons.svg will appear in your dist.

Finally, you can use the syntax below to reference an icon.

<svg class="icon">
  <use xlink:href="#my-icon"></use>
</svg>

You can use CSS to style the outer SVG element like this:

svg.icon {
  fill: currentColor;
}

You can verify my github repo to understand it in better way.

Webpack Integration in AEM

This is purely taken reference from https://www.bounteous.com/insights/2017/08/02/webpack-in-aem/

Just for my understanding, reference i am having it in my post with my own words..

  1. Copy the example Webpack folder, .browserslistrc and .gitignore to ui.apps/src/main.
  2. Extend your project’s pom.xml.

Reference links:

https://github.com/infielddigital/aem-webpack-example

https://www.bounteous.com/insights/2017/08/02/webpack-in-aem/

https://github.com/infielddigital/aem-webpack-example/tree/master/ui.apps

https://github.com/infielddigital/aem-webpack-example/tree/master/ui.apps/src/main

https://github.com/infielddigital/aem-webpack-example/blob/master/ui.apps/pom.xml

FrontEnd Maven Plugin – https://github.com/eirslett/frontend-maven-plugin

HTL Exercises links

Learn basics and advantages of HTL/Sightly is http://www.aemcq5tutorials.com/tutorials/sightly-new-features-vs-jsp-aem/

https://helpx.adobe.com/experience-manager/using/creating-htl-component.html

https://helpx.adobe.com/experience-manager/using/htl_email_template.html

https://helpx.adobe.com/experience-manager/using/aem_msdoc.html

https://helpx.adobe.com/experience-manager/using/htl_repeat.html

https://helpx.adobe.com/experience-manager/using/aem_headline.html

https://helpx.adobe.com/experience-manager/using/htl_news.html

https://helpx.adobe.com/experience-manager/using/restful_htl.html

https://helpx.adobe.com/experience-manager/using/htl_js.html

https://helpx.adobe.com/experience-manager/using/htl_multifield62.html

https://helpx.adobe.com/experience-manager/using/htl_ajax.html

https://helpx.adobe.com/experience-manager/using/htl_movie62.html

https://helpx.adobe.com/experience-manager/using/first_htl_WCMUsePojo.html

https://helpx.adobe.com/experience-manager/using/aem64_htl_movie_component.html

https://helpx.adobe.com/experience-manager/using/toy_login.html#CreateLogincomponentusingHTL

https://helpx.adobe.com/experience-manager/kt/eseminars/ask-the-expert/aem-deep-dive-into-developing-aem-components-using-htl.html