Invalid theme folder


#1

I am using a custom gem based theme locally.

gem "themename", '0.1.0', :path => "./"

But I am getting this error:

Invalid theme folder: _sass
Invalid theme folder: _includes
Invalid theme folder: _layouts

#2

The warnings mean that those directories do not exist within the current theme. If those directories do exist, you may want to check the regex in the theme’s gemspec file…


#3

All those directories do exist.

Here’s the .gemspec file

spec.files = `git ls-files -z`.split("\x0").select { |f| f.match(%r!^(_data|assets|_layouts|_includes|_sass|LICENSE|README)!i) }

When I run jekyll serve in the theme directory it works file, but when I use that same theme gem in some other jekyll site, it doesn’t work.


#4

Then its simply the incorrect entry in your Gemfile.
It should just be

gem "themename", :path => "path/to/themename"

There’s no need to include the version constraint when using the path parameter.
:path => "./" means “current directory” which is obviously not the case in another jekyll site.


#5

NOTE: I am using a local gem

If I use it without mentioning the version, it doesn’t work and I get this error.

Could not find gem 'themename' in source at `./`.
The source does not contain any versions of 'themename'
Run `bundle install` to install missing gems.

Here’s the tree structure.

image


#6

:path => should point to the directory containing your gemspec.

For example, if the theme is named theme-yashu, then I would have a directory named theme-yashu containing theme-yashu.gemspec with its spec.name = "theme-yashu"

Then the Gemfile in a site called yashu-site just outside theme directory theme-yashu would point to the theme gemspec:

gem "theme-yashu", :path => "../theme-yashu"