Cuberic
Cuberic

Reputation: 187

How to resolve Syntax error: Functions may only be defined at the root of a document. when compiling with Compass

I am trying to compile changes done to .scss files for ext js 4. When I compile the file compass outputs.

Syntax error: Functions may only be defined at the root of a document.
        on line 115 of G:/Ruby/bin/resources/themes/stylesheets/ext4/default/mixins/_frame.scss
        from line 4 of G:/Ruby/bin/resources/themes/stylesheets/ext4/default/_mixins.scss
        from line 9 of G:/Ruby/bin/resources/themes/stylesheets/ext4/default/_all.scss
        from line 118 of G:/Ruby/bin/resources/sass/ext-all-gray.scss

Backtrace:
G:/Ruby/bin/resources/themes/stylesheets/ext4/default/mixins/_frame.scss:115
G:/Ruby/bin/resources/themes/stylesheets/ext4/default/_mixins.scss:4
G:/Ruby/bin/resources/themes/stylesheets/ext4/default/_all.scss:9
G:/Ruby/bin/resources/sass/ext-all-gray.scss:118
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/check_nesting.rb:12:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `block in visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `map'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/check_nesting.rb:26:in `visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:39:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/check_nesting.rb:14:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `block in visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `map'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/check_nesting.rb:26:in `visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:39:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/check_nesting.rb:14:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `block in visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `map'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/check_nesting.rb:26:in `visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:37:in `block in visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:70:in `visit_if'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:37:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/check_nesting.rb:14:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `block in visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `map'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/check_nesting.rb:26:in `visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:39:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/check_nesting.rb:14:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `block in visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `map'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/check_nesting.rb:26:in `visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:37:in `block in visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/check_nesting.rb:33:in `visit_root'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:37:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/check_nesting.rb:14:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:24:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:143:in `visit_import'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:37:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:18:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:144:in `block in visit_import'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:144:in `map'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:144:in `visit_import'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:37:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:18:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:144:in `block in visit_import'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:144:in `map'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:144:in `visit_import'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:37:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:18:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `block in visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `map'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:53:in `visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:27:in `block in visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:39:in `with_environment'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:26:in `visit_children'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:37:in `block in visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:47:in `visit_root'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/base.rb:37:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:18:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/visitors/perform.rb:7:in `visit'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/tree/root_node.rb:20:in `render'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/engine.rb:300:in `_render'
G:/Ruby/lib/ruby/gems/1.9.1/gems/sass-3.1.10/lib/sass/engine.rb:247:in `render'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/compiler.rb:130:in `block (2 levels) in compile'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/compiler.rb:116:in `timed'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/compiler.rb:129:in `block in compile'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/logger.rb:45:in `red'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/compiler.rb:128:in `compile'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/compiler.rb:108:in `compile_if_required'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/compiler.rb:95:in `block (2 levels) in run'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/compiler.rb:93:in `each'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/compiler.rb:93:in `block in run'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/compiler.rb:116:in `timed'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/compiler.rb:92:in `run'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/commands/update_project.rb:36:in `perform'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/commands/base.rb:18:in `execute'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/commands/project_base.rb:19:in `execute'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/exec/sub_command_ui.rb:43:in `perform!'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/lib/compass/exec/sub_command_ui.rb:15:in `run!'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/bin/compass:25:in `block in <top (required)>'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/bin/compass:39:in `call'
G:/Ruby/lib/ruby/gems/1.9.1/gems/compass-0.11.1/bin/compass:39:in `<top (required)>'
G:/Ruby/bin/compass:19:in `load'
G:/Ruby/bin/compass:19:in `<main>'

body:before {
  white-space: pre;
  font-family: monospace;
  content: "Syntax error: Functions may only be defined at the root of a document.\A         on line 115 of G:/Ruby/bin/resources/themes/stylesheets/ext4/default/mixins/_frame.scss\A         from line 4 of G:/Ruby/bin/resources/themes/stylesheets/ext4/default/_mixins.scss\A         from line 9 of G:/Ruby/bin/resources/themes/stylesheets/ext4/default/_all.scss\A         from line 118 of G:/Ruby/bin/resources/sass/ext-all-gray.scss"; }

I've been scouring the internet for help and hints an all I've found was to use sass version 3.1.1. I've tried that and there was no change.

Upvotes: 0

Views: 1268

Answers (2)

ruedaminute
ruedaminute

Reputation: 579

You have to uninstall both compass and sass, reinstall sass version 3.1.1, and then reinstall compass. That did the trick for me.

Upvotes: 0

domgblackwell
domgblackwell

Reputation: 5100

Basically it means that your code or some third-party code you are using defines functions within a scope instead of at the root level. You can get this accidentally if you do an @import within a scope of a file which includes function definitions. What you normally need to do in this situation is do the @import at the root level and @include the mixins or insert calls to the functions in the relevant scope.

It is possible to downgrade SASS to fix this but long-term this is a feature that will not be supported by SASS if I understand correctly.

Upvotes: 1

Related Questions