madsflensted / elm-brunch

Brunch plugin to compile Elm code
MIT License
74 stars 31 forks source link

No color coding in terminal #28

Open jamonholmgren opened 7 years ago

jamonholmgren commented 7 years ago

Problem

When I run elm-brunch, I get monochromatic errors:

image

When I run elm-make directly, I get pretty errors:

image

Information

exports.config = {
  sourceMaps: false,
  production: true,
  npm: {
    enabled: true
  },

  files: {
    // javascripts: {
    //   joinTo: 'thesis-editor.js'
    // },
    stylesheets: {
      joinTo: 'thesis.css'
    }
  },

  // Phoenix paths configuration
  paths: {
    // Which directories to watch
    watched: ['web/elm'],

    // Where to compile files to
    // public: 'priv/static'
  },

  modules: {
    autoRequire: {
      'thesis-editor.js': ['web/static/js/thesis-editor']
    }
  },

  // Configure your plugins
  plugins: {
    // babel: {
    //   // Do not use ES6 compiler in vendor code
    //   ignore: [/^(web\/static\/vendor)/],
    //   presets: ['es2015', 'react']
    // },
    elmBrunch: {
      mainModules: ['web/elm/Main.elm'],
      outputFolder: 'priv/js/',
      outputFile: 'thesis-editor.js'
    }
  }
}
{
    "version": "0.0.21",
    "summary": "Thesis CMS - Content Management for Phoenix websites",
    "repository": "https://github.com/infinitered/thesis-phoenix.git",
    "license": "MIT",
    "source-directories": [
        "./web/elm"
    ],
    "exposed-modules": [],
    "dependencies": {
        "elm-lang/core": "4.0.5 <= v < 5.0.0",
        "elm-lang/html": "1.1.0 <= v < 2.0.0"
    },
    "elm-version": "0.17.1 <= v < 0.18.0"
}
madsflensted commented 7 years ago

That would be a great feature, don't hold back if you want to submit a PR for this.

niklas commented 7 years ago

I think this is caused by elm-make failing to detect a TTY (a "proper" terminal) [1] because it is executed by brunch. The canonical solution seems to implement a command-line flag in elm-make [2].

[1] https://github.com/elm-lang/elm-make/blob/master/src/Report.hs#L35 [2] http://unix.stackexchange.com/questions/10823/where-do-my-ansi-escape-codes-go-when-i-pipe-to-another-process-can-i-keep-them

jamonholmgren commented 7 years ago

@niklas That's incredibly helpful. Thanks. I'll file an issue with elm-make and possibly work on it if I can find time.