 
 class GeneratedFile
   constructor: (@path, @sourceFiles, @config) ->
-    null
-  
-  # Collects content from a list of files and wraps it with
-  # require.js module definition if needed.
-  getData: (files) ->
-    data = ''
-    data += requireDefinition if /\.js$/.test @path
-    data += files.map((file) -> file.data).join ''
-    data
-    
+    @type = if (@sourceFiles.some (file) -> file.type is 'javascript')
+      'javascript'
+    else
+      'stylesheet'
+
   _extractOrder: (files, config) ->
     types = files.map (file) -> pluralize file.type
     arrays = (value.order for own key, value of config.files when key in types)

class exports.FileWriter extends EventEmitter
  constructor: (@config, @plugins) ->
    @destFiles = []
    @initFilesConfig @config.files

  initFilesConfig: (filesConfig) ->
    # Copy config.
    config = helpers.extend filesConfig, {}
    for own type, data of config

      }
    , {before: [], after: []}

  # Collects content from a list of files and wraps it with
  # require.js module definition if needed.
  joinSourceFiles: ->
    files = @sourceFiles
    pathes = files.map (file) -> file.path
    order = @_extractOrder files, @config
    sourceFiles = (helpers.sort pathes, order).map (file) ->
      files[pathes.indexOf file]
    data = ''
    data += requireDefinition if @type is 'javascript'
    data += sourceFiles.map((file) -> file.data).join ''
    data

  minify: (data, callback) ->
    if @minifier?.minify?
      @minifier.minify data, @path, callback
    else
      callback null, data

  write: (callback) ->
    @minify @joinSourceFiles(), (error, data) =>
      writeFile @path, data, callback

# A simple file changes watcher.
# 
