tvooo / sublime-grunt

Moved to https://github.com/sptndc/sublime-grunt
296 stars 35 forks source link

[Bug] Gruntfile.coffee don't support #112

Closed Kristinita closed 5 years ago

Kristinita commented 7 years ago

1. Summary

If I use Gruntfile.coffee file instead of Gruntfile.js, tasks don't run for me. If I use Gruntfile.js, tasks successful run for me.

2. Settings

My Gruntfile.coffee file:

# @Author: Kristinita
# @Date:   2017-04-05 20:11:18
# @Last Modified time: 2017-04-11 08:20:09

module.exports = (grunt) ->
  grunt.loadNpmTasks 'grunt-shell'
  grunt.loadNpmTasks 'grunt-move'
  grunt.loadNpmTasks 'grunt-contrib-clean'
  grunt.loadNpmTasks 'grunt-text-replace'
  grunt.loadNpmTasks 'grunt-jsbeautifier'
  grunt.initConfig
    ###################
    ## Pelican build ##
    ###################
    ## http://manos.im/blog/static-site-pelican-grunt-travis-github-pages/
    ## https://github.com/sindresorhus/grunt-shell
    shell:
      generate: command: 'pelican content -s pelicanconf.py'
      deploy: command: 'pelican content -s publishconf.py'
    ##################################
    ## Move files to another folder ##
    ##################################
    ## https://www.npmjs.com/package/grunt-move
    move:
      options:
        ignoreMissing: true
        moveAcrossVolumes: true
      ## Favicons
      favicons:
        src: 'output/favicons/*'
        dest: 'output/'
      ## HTML, which I need to move in root folder
      roothtml:
        src: 'output/root-html/*'
        dest: 'output/'
      ## Different file types
      extra:
        src: 'output/extra/*'
        dest: 'output/'
    ##########################
    ## Delete blank folders ##
    ##########################
    ## https://github.com/gruntjs/grunt-contrib-clean
    clean: [
      'output/extra'
      'output/favicons'
      'output/root-html'
    ]
    ##################
    ## Replace text ##
    ##################
    ## https://github.com/yoniholmes/grunt-text-replace
    replace: replacehtml:
      src: [ 'output/**/*.html' ]
      overwrite: true
      replacements: [
        ## Incorrect paths for personal CSS and JavaScript,
        ## https://github.com/mortada/pelican_javascript/issues/3
        {
          from: 'css/personal'
          to: '../css/personal'
        }
        ## Fancybox images,
        ## With regex: https://github.com/yoniholmes/grunt-text-replace#usage
        {
          from: /<img alt="(.+?)" src="(.+?)" \/>/g
          to: '<a class="fancybox" href="$2"><img src="$2" alt="$1"></a>'
        }
        ## Cllipboard.js,
        ## http://ru.stackoverflow.com/a/582520/199934
        ## http://stackoverflow.com/a/33758293/5951529
        {
          from: /<pre><code class="(.+?)">((.|\n|\r)+?)<\/code><\/pre>/g
          to: '<pre><code data-language="$1">$2</code><button class="SashaButton SashaTooltip"><img src="../images/interface_images/clippy.svg" alt="Clipboard button" width="13"></button></pre>'
        }
      ]
    ###################
    ## js-beautifier ##
    ###################
    ## https://github.com/vkadam/grunt-jsbeautifier
    jsbeautifier: files: [ 'output/**/*.html' ]
  grunt.registerTask 'build', [
    'shell:generate'
    'move'
    'clean'
    'replace'
  ]
  grunt.registerTask 'publish', [
    'shell:deploy'
    'move'
    'clean'
    'jsbeautifier'
    'replace'
  ]
  return

3. Steps to reproduce

I reproduce the problem in a version of Sublime Text without plugins and user settings.

I install SublimeGrunt → I restart Sublime Text → I open any file in my project with Gruntfile.coffee file → Ctrl+Shift+P (⌘⇧p for Mac) → Grunt.

4. Expected behavior

I successful build my project in terminal:

D:\Kristinita>grunt build
Running "shell:generate" (shell) task
Done: Processed 0 articles, 0 drafts, 14 pages and 0 hidden pages in 10.53 seconds.

Running "move:favicons" (move) task
>> 10 files or directories moved, 0 failed.

Running "move:roothtml" (move) task
>> 3 files or directories moved, 0 failed.

Running "move:extra" (move) task
>> 7 files or directories moved, 0 failed.

Running "clean:0" (clean) task
>> 1 path cleaned.

Running "clean:1" (clean) task
>> 1 path cleaned.

Running "clean:2" (clean) task
>> 1 path cleaned.

Running "replace:replacehtml" (replace) task

Done.

5. Actual behavior

My build is not success, I get stack trace in Sublime Text console:

command: grunt
Traceback (most recent call last):
  File "D:\Sublime Text Build 3126 x64 For Debug\sublime_plugin.py", line 797, in run_
    return self.run()
  File "D:\Sublime Text Build 3126 x64 For Debug\Data\Packages\Grunt\main.py", line 148, in run
    GruntRunner(self.window)
  File "D:\Sublime Text Build 3126 x64 For Debug\Data\Packages\Grunt\main.py", line 16, in __init__
    self.list_gruntfiles()
  File "D:\Sublime Text Build 3126 x64 For Debug\Data\Packages\Grunt\main.py", line 83, in list_gruntfiles
    self.choose_file(0)
  File "D:\Sublime Text Build 3126 x64 For Debug\Data\Packages\Grunt\main.py", line 93, in choose_file
    self.tasks = self.list_tasks()
  File "D:\Sublime Text Build 3126 x64 For Debug\Data\Packages\Grunt\main.py", line 21, in list_tasks
    json_result = self.fetch_json()
  File "D:\Sublime Text Build 3126 x64 For Debug\Data\Packages\Grunt\main.py", line 54, in fetch_json
    if data[self.chosen_gruntfile]["sha1"] == filesha1:
KeyError: 'D:\\Kristinita\\Gruntfile.coffee'

6. Environment

Operating system and version: Windows 10 Enterprise LTSB 64-bit EN Sublime Text: Build 3126 Package: I use the latest version of this package for Sublime Text 3 Grunt: v1.0.1

Thanks.

tvooo commented 5 years ago

Repository was moved to https://github.com/sptndc/sublime-grunt Please re-file any issues that still exist.