🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

asimov-build

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

asimov-build

Grunt tasks to compile an Asimov project

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

asimov-build

Grunt tasks to compile an Asimov project.

Getting started

Install asimov-build via npm

npm install asimov-build --save-dev

Require asimov-build in your Gruntfile:

var build = require('asimov-build')(grunt);

Add the following following config keys fo your Gruntfile.js with the corresponding source and destination file locations for your applications scss and js files.

paths: {
    css: {
        src: 'src/scss',
        dist: 'dist/css'
    },
    js: {
        src: 'src/js',
        dist: 'dist/js'
    }
}

Some Asimov components will have their own assets like fonts or images. You can configure where they're copied with the paths.assets.dist key.

paths: {
    assets: {
        dist: 'dist'
    }
}

Building Asimov

From here you can let asimov-build bootstrap Grunt with the necessary config and tasks for compiling Asimov.

Alternative if you're not using Grunt, or simply don't want any magic in your asset pipeline you can query the specific config you'll need to integrate Asimov if your application.

API

The core things you'll need to get Asimov compiling are correctly configured Sass load paths, and RequireJS compilation targets.

getSassLoadPaths

Returns an array of path that need to be part of Sass' load_path config.

getRequireJSComponents

Returns an object of RequireJS configs. This can be passes directly to grunt-contrib-requirejs or you can iterate over each key and pass it's to requirejs.config().

This method optionally takes an object of r.js options which is use to normalise some configs like paths.

bootstrap

This is the simpliest way to get up with Asimov. It will load and configure a handful of grunt plugins with sane defaults.

If you Gruntfile already configures task asimov-build wants to bootstrap it will simply add any additionally required config.

note only ever call the bootstrap function after calling grunt.initConfig.

Config flags

use_bundler

Type: bool Default: true

Whether to use bundler when running tasks that use ruby i.e. sass

Example

An example setup might look like this

module.exports = function(grunt) {
    'use strict';

    //
    // Initialize config
    //

    grunt.initConfig({

        // Your grunt config here


        // Make some path information available to tasks
        //
        // Consumers of asimov-build should set these for their application

        paths: {
            css: {
                src: 'src/scss',
                dist: 'dist/css'
            },
            js: {
                src: 'src/js',
                dist: 'dist/js'
            },
            assets: {
                dist: 'dist'
            }
        },

        //
        // Asimov build config
        //

        asimov_build: {
            use_bundler: false
        }

    });

    // Bootstrap asimov-build.
    //
    // Always run this after calling `grunt.initConfig`
    // or bad things _will_ happen!

    var build = require('asimov-build')(grunt);
    build.bootstrap();

};

FAQs

Package last updated on 22 May 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts