Skip to content

Gulp Path Setup as an Object #340

Description

@grayghostvisuals

Been trying to setup my paths in a DRY fashion sort of like <% %> does for Grunt. Can't seem to nail it here. It works when I hard code the paths but when I try and abstract them it fails.

var paths = {
    views: 'app/views/',
    assets: 'public/',
    templates: [this.views + '**/*.php'],
    js: [this.assets + 'js/*.js'],
    sass: [this.assets + 'css/src/**/*.scss'],
    css: [this.assets + 'css'],
    images: [this.assets + 'img/**/**']
},
css_dir = paths.assets + 'css',
min_js_dir = paths.assets + 'js/min/';

Activity

  1. doowb commented on Mar 12, 2014

    @doowb
    Member

    Try changing this.assets to paths.assets. The way you're using this is in the wrong context at that point.

  2. grayghostvisuals commented on Mar 12, 2014

    @grayghostvisuals
    Author

    @doowb Yeah did that one too. Just found out this might be an issue with gulp-ruby-sass. had a friend switch to gulp-sass and was able to do it this way. :\

  3. grayghostvisuals commented on Mar 12, 2014

    @grayghostvisuals
    Author

    Actually just configured like so and worked like a charm…

    var assets_dir = 'public/',
        js_dir_min = paths.js + 'min/';
    
    var paths = {
        views: 'app/views/',
        sass: assets_dir + 'css/src/',
        css: assets_dir + 'css/',
        js: assets_dir + 'js/',
        img: assets_dir + 'img/'
    };
    
    var assets = {
        views: [paths.views + '**/*.php'],
        sass: [paths.sass + '**/*.scss'],
        js: [paths.js + '*.js'],
        img: [paths.img + '**/**']
    };
  4. grayghostvisuals commented on Mar 13, 2014

    @grayghostvisuals
    Author

    Leaving this issue open because their should be something in the docs that explains if -or- if not something like <% placeholder from package.json %> that you can use with Grunt is possible with gulp.

  5. yocontra commented on Mar 13, 2014

    @yocontra
    Member

    @grayghostvisuals You're welcome to submit a PR to add a recipe for this to the documentation

  6. grayghostvisuals commented on Mar 13, 2014

    @grayghostvisuals
    Author

    looks like u have one already in that config file found through recipes. thanks for linking me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions