title: Ionic: Convert a JSON file to a class or constant during build process
body: <p>I’m converting an <code>Ionic</code> 1 app to <code>Ionic</code> 3. In that <code>Ionic</code> 1 app we had a <code>build</code> process similar to the <code>Ionic</code> 3 one, and we used <code>gulp</code> for that. One of the things this process did was read a config.json file and convert it to a <code>constant</code>. So we converted something like:</p>
  
  <pre><code>{
      "cache_expiration_time": 300000,
      "default_lang": "en",
      ...
  }
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>angular.module('mm.core').constant('mmCoreConfigConstants', {
      "cache_expiration_time" : 300000,
      "default_lang" : "en",
      ...
  });
  </code></pre>
  
  <p>The reason is that we wanted to be able to access these constants synchronously from anywhere, without having to create a service to read the file and parse it.</p>
  
  <p>I’d like to do the same in <code>Ionic</code> 3, maybe creating a class that I can import where I want to use it. I’ve been reading a lot of documentation about the <code>Ionic</code> <code>build</code> process, and I don’t see a clear way to do it. I think the <code>package.json</code>'s <code>config</code> attribute doesn’t work for me, since my task doesn’t belong to any of the available options.</p>
  
  <p>I thought that maybe I could create my own task (<code>gulp</code> or <code>npm</code>) to create this “constants” class in my <code>src</code> folder before the <code>Ionic</code> build process starts, then run the build and, when it’s done, delete this new class from the <code>src</code> folder. However, I don’t know how can I add new tasks to the <code>Ionic</code> <code>build</code> process without having to create my own “npm script” (I’d like to keep using <code>ionic serve</code> instead of “npm run whatever”).</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks!</p>