css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

            
              /* 
 * Intercepter le contenu des `variations/*.json` avant affichage.
 * `params` va contenir ce qu'il nous faut pour bosser et
 * `mainCallback` sera a exécuter une fois le travail terminé.
 */
exports.changeVariations = function (next, locals) {

  /*
   * On récupère les variations de NodeAtlas ainsi que 
   * le module Node.js `ejs` qui va servir à parser `includeComponent()`
   * et `sc`.
   */
  var NA = this,
      ejs = NA.modules.ejs;

    /*
     * Création de notre fonction `includeComponent()` utilisée dans notre Template
     * pour inclure les Components. On précise dans cette fonction le `placeholder` à
     * parcourir dans notre fichier de variation.
     */
    locals.ic = locals.includeComponent = function (placeholder) {
      var render = "",

      /*
       * On récupère la liste des Placeholders de Components.
       */
      currentComponents = locals.specific.components;

      /*
       * Si le Placeholder existe, et contient des Componants, on va les parcourir.
       */
      if (typeof currentComponents[placeholder] === 'object' && currentComponents[placeholder].length > 0) {
        for (var i = 0; i < currentComponents[placeholder].length; i++) {

        /*
         * Pour chaque Component réclamé, on va inclure le fichier de `path` avec 
         * les variations de `variation` qui seront accessibles depuis la variable
         * `component` dans le fichier du Component. Voir la documentation EJS pour
         * l'utilisation de `render`.
         */
        render = render + ejs.render(
          '<%- include("' + currentComponents[placeholder][i].path + '", { component: specific.components["' + placeholder + '"][' + i + '].variation }) %>',
          variation
        );
      }
    }

    return render;
  };

  /*
   * Création de notre fonction `sc()` (pour `semanticComponent()`) utilisé 
   * dans notre Component. Cette fonction unique transformera les `section`
   * en ce qui est réclamé par `mainTag` et transformera
   * <(header|footer|h1|h2|h3|h4|h5|h6)> en `<div class="$1-like">`
   */
  locals.sc = locals.semanticComponent = function (markup, component) {
    if (typeof component !== 'undefined' && component.mainTag) {
      /*
       * Transformer <(header|footer|h1|h2|h3|h4|h5|h6)> en `<div class="$1-like">`
       * si le mainTag réclamé est un `div`, `header` ou `footer`
       */
      if (component.mainTag === "div" || component.mainTag === "header" || component.mainTag === "footer") {
      markup = markup
        /* On transform l'item en item-like dans la classe. */
        .replace(/^<(header|footer|h1|h2|h3|h4|h5|h6)/g, '<div class="$1-like"')
        /* Si l'attribut `class` était déjà présent, on merge $h1-like avec le reste. */
        .replace(/^<div class=(")(header|footer|h1|h2|h3|h4|h5|h6)-like(")(.+)(class=)('|")(.+)('|")/g, '<div class=$8$2-like $7$8')
        /* On s'occupe de la balise fermante. */
        .replace(/^<\/(header|footer|h1|h2|h3|h4|h5|h6)/g, "</div");
      }

      /*
       * Transformer <(header|footer|h1|h2|h3|h4|h5|h6)> en `<div class="$1-like">`
       * si le mainTag réclamé est un `div`, `header` ou `footer`
       */
      markup = markup
        .replace(/^<section/g, "<" + component.mainTag)
        .replace(/^<\/section/g, "</" + component.mainTag);
    }

    /* Retourner le résultat ou une chaine vide. */
    return markup;
  };

  /* Éviter le plantage quand `component` est vide côté HTML. */
  locals.component = {};

  /* Continuer le Process normal de NodeAtlas. */
  next();
};
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console