Dan Dan - 4 months ago 31
AngularJS Question

AngularJS + Gulp files and folders structure and right gulpfule.js config

I want to create a three page app, i need follow structure:


public (for production version)


How should i create a tasks for scripts (scripts in different folders) in gulpfile.js?

Maybe my structure is wrong, then how could it to look like?


Your structure seems right. You can use any architecture you want for your project. Regarding Gulp, you just have to know how to filter the javascript source files when you call gulp.src(). It should be something like this:

gulp.task('scripts', function() {
    return gulp.src('./app/**/*.js')
        .pipe() //Do whatever process you need here

A quick recommendation would be to create a gulp.config.js file to handle all the string variables, filters, directories, among others. Then require it in your gulpfile.js and use those variables to provide a cleaner code. It should be something around this:

gulp.config.js (located in the same folder of the gulpfile.js)

module.exports = function() {
    var src = './app/';
    var dest = './assets/';

    var config = {
        js: {
            src: src + '**/*.js',
            dest: dest + 'js/'

    return config;


var config = require('./gulp.config.js')();


gulp.task('scripts', function() {
    return gulp.src(config.js.src)
        .pipe() //Do whatever process you need here

This should work for you.