npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

iron-fe

v2.3.12

Published

An opinionated - yet flexible - front end development framework for use with Adobe Experience Manager

Downloads

71

Readme

Iron(Fe)

Iron (Fe) is an opinionated yet flexible FrontEnd development framework.

Why another front end tool?

We want Iron to be a foundation for projects. Like all foundations Iron(Fe) is a place to start, but a foundation is just a beginning. There can be many directions you can go after you have a firm foundation. We want to give front end developers who work with AEM access to the same tools that we have when working outside AEM. Iron makes a few decisions for you.

Where is Iron opinionated?

  • Iron encourages you to write your components in small sets of independent functionality.
  • All components are blueprinted common js modules.
    • with a main.js and a main.css files these small bits of code will help you stay organized as your project grows.
  • Components are bundled via Browserify webpack or whatever else you fancy.
  • Bundles are formed in client libraries.
    • once the code is bundled it can be moved to a client library in AEM and then built via maven.

To install Iron's Generator

npm install -g iron-fe

Use Iron with a new project

iron myProjectName

Once you have initialized Iron in your project you can use any of these commands.

Options:

    -h, --help              output usage information
    -V, --version           output the version number
    -c, --component [name]  Create a component with specified name
    -b, --bundle [name]     Create an AEM bundle with a specified name
    -l, --clientlib [name]  Create a Client Library with a specified name

API

iron.bundles

The functions nested under bundles are to help you construct the bundles that can get moved into client libraries.

bundles.match( filePath )

Bundles.match takes a file path of a component and will return a list of bundles. Each of those bundles are an explicit dependency of an individual component.

import iron from 'iron-fe'; // var iron = require( 'iron-fe' );
let myComponentPath = "the/path/to/my/component.js"
iron.bundles.match( myComponentPath )
bundles.get

Here you have the option of getting all or just one of the bundles you have generated in the aem-bundles folder.

bundles.get.one( bundleName )

This function will give you one bundle back with its relevant information.

 import iron from 'iron-fe'; // var iron = require( 'iron-fe' );
 let myBundle = iron.bundles.get.one( 'myBundle' );

 ---------
 {
    components: [
        { name: 'appEntry', isGlobal: false },
        { name: 'maps', isGlobal: false }
    ],
    name: 'mainApp',
    path: 'aem-bundles/app',
    main: 'main.directories.js',
    config:  {
        clientLibPath: '/Absolute/Path/to/bundle',
        autoGenerate: { js: true, styles: true },
        useGlobalComponents: true,
        components: [ 'appEntry', 'maps' ]
    }
 }
bundles.get.all()

This function will give you all bundles you have in your project with each bundle's relevant information.

 import iron from 'iron-fe'; // var iron = require( 'iron-fe' );
 let bundles = iron.bundles.get.all( );

 ---------
 [
    {
        components: [
            { name: 'appEntry', isGlobal: false },
            { name: 'maps', isGlobal: false }
        ],
        name: 'mainApp',
        path: 'aem-bundles/app',
        main: 'main.mainApp.js',
        config:  {
            clientLibPath: '/Absolute/Path/to/clientlib',
            autoGenerate: { js: true, styles: true },
            useGlobalComponents: true,
            components: [ 'appEntry', 'maps' ]
        }
    },
    {
        components: [
            { name: 'appEntry', isGlobal: false },
            { name: 'maps', isGlobal: false }
            { name: 'fonts', isGlobal: false }
        ],
        name: 'homePape',
        path: 'aem-bundles/homePape',
        main: 'main.homePape.js',
        config:  {
            clientLibPath: '/Absolute/Path/to/clientlib',
            autoGenerate: { js: true, styles: true },
            useGlobalComponents: true,
            components: [ 'appEntry', 'maps', 'fonts' ]
        }
    }
 ]
bundles.buildComponentTree();

This can be used in a build pre build step to generate an object of all the components listed in the bundles config json.

/**
*
* This file was generated. To edit the contents edit the
* .ironrc file for your project.
*
*/

export default {
    'nav' : require( './../../components/nav/nav.js' ),
    'footer' : require( './../../components/footer/footer.js' ),
    'video' : require( './../../components/video/video.js' )
}

Custom Iron Templates

Iron will add a iron-templates folder to you iron-fe folder. In the iron-templates folder you will find 3 sub-folders. You can add your own custom template files here for each generator. For instance if your project has a base include that ever javascript component should have you can add a project specific template there.

Creating your custom template

  1. Choose the folder in which you want to add you custom template in the iron-templates folder
  2. Add a new file to that folder and name it what ever you want with an extension of extension.template.
    • For example if I wanted a custom javascript template for the component generator the template file name might look like this ironDemo.js.template
  3. Once you have your template open up the .ironrc file and change the key in the templateConfigs object to match the name of your new template.
    • using the same example above. I would change the templateConfigs.components.js from ironDefault to ironDemo.