question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Brunch recompiles when ignored file is saved

See original GitHub issue

Description

I’m trying to update all of the dependencies in my app so that the addition of babel-brunch doesn’t fail. Everything is peachy in the package.json below except that hitting ctrl-s in sublime on an “ignored” file causes the brunch compile and auto-reload to happen which is not the desired behavior.

To verify that the ignored files are indeed still being ignored, I commented out one of the config.conventions.ignored lines and noted compiled, but not written errors as expected. So it seems brunch is correctly ignoring the files during compile, but is triggering a recompile for no reason… Any ideas?

Note that this was all working as expected with much older versions of everything. (See old package.json excerpt below.)

Environment

  1. Brunch: 2.9.1
  2. Node: 6.9.2
  3. NPM: 3.10.9
  4. Operating system: OSX 10.10.5

package.json contents

  "devDependencies": {
    "angularjs-templates-brunch": "~1.0.0",
    "auto-reload-brunch": "~2.7.1",
    "babel-brunch": "~6.0.6",
    "bower": "~1.8.0",
    "brunch": "~2.9.1",
    "clean-css-brunch": "~2.0.0",
    "css-brunch": "~2.6.1",
    "javascript-brunch": "~2.0.0",
    "keyword-brunch": "git://github.com/urosgruber/keyword-brunch.git#5ee50ec4cbce7f70af32bbca10d3368e90af3e29",
    "less-brunch": "~2.7.1",
    "package-brunch": "~0.3.1"
  },

brunch config contents

exports.config = {
  npm: {
    enabled: false
  },
  conventions: {
    assets: /(^app\/assets|font)/,
    ignored: [
      /^(.*?\/)?[_]\w*/,
      /\.spec\.js$/,
      /\.interface\.js$/,
    ],
  },
  modules: {
    definition: false,
    wrapper: false
  },
  paths: {
    'watched': ['app', 'vendor'],
    'public': '_public'
  },
  files: {
    javascripts: {
      joinTo: {
        'js/app.js': /^app((?!\.spec\.js)(?!\.interface\.js).)*$/,
        'js/vendor.js': /^bower_components|^vendor/
      },
      order: {
        before: [
          'app/utilities/lodash-mixins.js',
        ],
      }
    },
    stylesheets: {
      joinTo: {
        'css/app.css': /^app/
      },
      order: {
        before: ['app/styles/app.less']
      }
    },
    templates: {
      joinTo: {
        'js/templates.js': /^app/
      },
      order: {
        before: ['app/scripts/app.js']
      }
    }
  },
  plugins: {
    // include sentry URL in
    keyword: {
      extraFiles: ['_public/js/app.js'],
      map: {
        THING: process.env.THING || '',
      },
    },
    // include package.json so that we can grab it in app/services/environment.js
    package: {
      fileName: '../js/package.js',
      fileSource: 'package.json',
      nameSpace: 'node',
    },
    // remove app/ from path strings since it applies to all templates
    angular_templates: {
      path_transform: function(path) {
        return path.replace(/app\//, '');
      }
    },
    // Enable or disable minifying of result js / css files.
    // minify: true
  },
};

Other useful files

This previously worked with a set of very old dependencies and node 0.12. Here is the relevant package.json bit:

  "devDependencies": {
    "aang-template-brunch": "~1.7.6",
    "auto-reload-brunch": ">= 1.0 < 1.8",
    "bower": "~1.3.5",
    "brunch": "~1.7",
    "clean-css-brunch": ">= 1.0 < 1.8",
    "css-brunch": ">= 1.0 < 1.8",
    "javascript-brunch": ">= 1.0 < 1.8",
    "keyword-brunch": "1.7.8",
    "less-brunch": ">= 1.0 < 1.8",
    "package-brunch": "^0.3.1"
  },

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
denysdovhancommented, Dec 28, 2016

@joshvillbrandt one suggestion: scripts from node_modules/.bin are available in npm scripts, so there is no need to write whole path. Parentheses aren’t necessary too (exit code will be correct). Your script might be simplified:

"start-protractor": "npm run build-protractor && http-server _public -p 3333 -s --push-state",
0reactions
joshvillbrandtcommented, Jan 3, 2017

That still doesn’t help me use brunch the way I’d like to, but thanks for the tip.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Xcode disable recompiling every time I Git Checkout
Every time I git checkout another branch, even simple one file changes, Xcode has to recompile everything and it takes forever and slows...
Read more >
Brunch Documentation - Read the Docs
Watch application files with brunch watch --server and see the results in browser on ... Will check against files that would be ignored...
Read more >
Potentially removing brunch from the Phoenix new template ...
So I spent this morning disabling brunch just commented its like in my dev.exs file, it 'works', mostly (it has bugs that necessitate...
Read more >
html-brunch-static - npm
html . You can do this (and set partials and layouts to something like "**/_*" ), but be aware that, by default, brunch...
Read more >
How to use React with Typescript in Phoenix (failed attempt)
Note that these files are kept in-memory in Brunch as far as I can tell, ... You can still engineer it correctly to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found