Code Monkey home page Code Monkey logo

gulp-assets-builder's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gulp-assets-builder's Issues

Project goals

Why we made assets-builder

We wanted to move away from desktop tools such as Prepros, CodeKit, Koala etc., to a build system that could be committed in each project (package.json, config file, etc.).

We settled on gulp, and after a while we realized that our gulp tasks often had similar configuration: files to process with some tool(s), files to watch, and where to write the result. Also basic gulp tasks were not great at notifying users when things went wrong (or right), so we tried to improve that with notifications (both system notifications and console logs).

In the end, we refactored our code with two goals:

  1. Make it possible for designers and front-end developers to just write some config (instead of having to tweak or rewrite gulp tasks).
  2. Make it easier to write new tasks by separating task functions from helper functions (system notifications, resolving config, dynamically generating watch tasks).

Why we’re sharing it

We think it’s a nice example of how one can write gulp tasks with usability in mind, and it can work as a starting point to copy and build on top.

Don’t like the tasks we provide?

  • Remove them (don’t forget to remove their dependencies from package.json too, e.g. to avoid downloading useless Sass or PhantomJS binaries) and write your own.
  • You can keep using the automatic generation of build/watch tasks, multiple configurations (and builds) per task, etc.

Will we publish it on npm?

Not sure yet. We might publish the “helpers” part, but not the tasks themselves (except as examples in this repo).

try/catch in task require kills all errors from the task

In assets-builder/index.js.

try {
  builder = require('./tasks/' + key + '.js')
  var taskNames = register(config[key], key, builder)
  activeTasks = activeTasks.concat(taskNames)
}
catch(err) {
  var filename = path.basename(__dirname) + '/tasks/' + key + '.js'
  notify({
    title: 'Ignoring \''+ key + '\' config',
    message: 'No task at \'' + filename + '\''
  })
}

Intent was to catch errors when user defines a config key that matches no tasks/key.js file, but if the file does exist but requiring it throws an error (apparently some JS modules do that), the error is silent.

Instead, maybe look for tasks/key.js, ignore and warn if missing, and require otherwise (letting any error go through).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.