Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop Grunt template processing for a file #53

Open
evil-shrike opened this issue Dec 6, 2016 · 2 comments
Open

Stop Grunt template processing for a file #53

evil-shrike opened this issue Dec 6, 2016 · 2 comments

Comments

@evil-shrike
Copy link

I have a markdown page with a fenced code block which contains Grunt's template syntax (<%=)

bla-bla-bla
\``` 
            test: {
                options: {              
	                urls: ['http://127.0.0.1:<%= connect.test.options.port %>/tests-runner.html']
                }
            }
\```

Building of this page fails somewhere inside Grunt. In grunt.config actually. As it detects its template syntax and try to evaluate it.
It's template syntax but it's documentation not code.

All this happens before md processing and HB-helpers evaluating - I can see raw markdown content in debugger.
Stacktrack:
grunt.config
processContext, assemle.js#613
build, assemle.js#556
assemble.js#397

Is it possible to avoid Grunt's template processing against file content?

@assemblebot
Copy link

@evil-shrike Thanks for the issue! If you're reporting a bug, please be sure to include:

  • The version of assemble you are using.
  • Your assemblefile.js (This can be in a gist)
  • The commandline output. (Screenshot or gist is fine)
  • What you expected to happen instead.

@evil-shrike
Copy link
Author

grunt-assemble 0.5
Output:

Warning: An error occurred while processing a template (Cannot read property 'options' of undefined). Use --force to continue.

My Gruntfile is pretty big but basically it's something like this:

    assemble: {
      options: {
        assets: config.dest + '/assets',
        flatten: true,
        layoutdir: 'templates/layouts',
        data: 'data/metadata/*.{json,yml}',
        partials: 'templates/partials/*.hbs',
        helpers: 'templates/helpers/**/*.js',
        config: '<%= config %>',
        build: {
          now: moment(now).format('DD.MM.YYYY'),
          // it's for 'last-modified' HB-helper:
          sources: {
            docs: {
              src: config.wcPath + '/Docs/articles/',
              dest: '_stage/docs/'
            },
            caseStudy: {
              src: config.csPath + '/Docs/',
              dest: '_stage/casestudy/'
            }
          }
        },
        collections: [{
          name: 'root',
          sortby: 'order'
        }, {
          name: 'section'
        }, {
          name: 'pages'
        }],
        plugins: [
          'plugins/lunr-indexer',
          'plugins/page-toc'
        ],
        lunr: {
          dataPath:  '<%= config.versionRoot %>/search_index.json',
          indexPath: '<%= config.versionRoot %>/search_index_index.json',
          baseDir:   '<%= config.dest %>\\<%= config.versionDir %>'
        },
	    toc: {
		  depth: 4,
		  autoInsert: true
	    }
      },
      casestudy: {
        options: {
          layout: 'casestudypage.hbs'
        },
        files: [{
            expand: true,
            cwd: '_stage',
            src: ['casestudy/*.md'],
            dots: true,
            dest: config.versionRoot + '/',
            ext: '.html'
          }, {
            expand: true,
            cwd: 'templates/pages',
            src: ['casestudy/*.hbs'],
            dots: true,
            dest: config.versionRoot + '/',
            ext: '.html'
	      }
        ]
      },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants