I'm using Drupal 8.2.7 and have download Bootstrap theme version 8.x-3.2. I've read the docs and made a subtheme. I can see the sass files. I copied the Bootstrap library into the subtheme root so I have themes/mysubtheme/bootstrap. I'm assuming that's the right place for it.

But I can't get grunt installed. I have it npm and bower installed globally. I see a gruntfile.js, bower.json and package.json in the bootstrap base theme but I can't get them into my subtheme. I can't I just copy them. I get errors about missing modules.

I tried running npm init and it created a package.json file, but then when I ran npm install grunt, I got the node_modules with grunt in it. I expected gruntfile.js to be in my subtheme's root. I can't find anything in the docs for what to do about this, btw. The docs said I'd need a sass compiler but didn't walk me through it. I tried going to https://sevaa.com/blog/build-drupal-8-bootstrap-subtheme-sass/ and getting compass, which I already have intalled on my system. I made the config.rb file and tried to run compass watch and got errors. What to do? Any help appreciated.

Comments

ricksta created an issue. See original summary.

markhalliwell’s picture

I see a gruntfile.js, bower.json and package.json in the bootstrap base theme but I can't get them into my subtheme. I can't I just copy them. I get errors about missing modules.

The files you found in the base theme are only intended to help with the automation of maintaining the base theme itself (for maintainers only). They are not intended for starterkits/sub-themes.

I tried running npm init and it created a package.json file, but then when I ran npm install grunt, I got the node_modules with grunt in it. I expected gruntfile.js to be in my subtheme's root.

There is no automated tooling in the starterkits and for good reason (see related issues). Some people want grunt, some people want gulp. Some don't want any at all (e.g. ruby/compass or plain CSS).

The reason you got node_modules/grunt and not a Gruntfile.js file is because the command npm install grunt installs grunt into node_modules. It does not generate a "predefined Gruntfile.js" file. These are unique to each and every project. I'd recommend reading Grunt.js: Getting Started.

The docs said I'd need a sass compiler but didn't walk me through it.

Because it assumes that if you have chosen a precompiler starterkit, you should know how to set this up. Precompilers are not specific to this project or the external front-end framework and there are tons of tutorials and blogs out there to help you learn. There is no need to duplicate this information in this project's documentation.

Quite frankly, if you don't know how precompilers or automated toolings work, you probably shouldn't be using them in the first place.

ricksta’s picture

Thanks. Or, the theme could just have a gruntfile included, maybe. I've been using sass for years now. And have always gotten by with either a config.rb, or with Drupal's Foundation theme, a subtheme can be set up with a drush fst . Zen is the same way. Guess I'll have to dive in and take a stab at it.

markhalliwell’s picture

Or, the theme could just have a gruntfile included, maybe.

That's what the related issue is about. It's also why I started https://github.com/unicorn-fail/grunt-drupal-bootstrap. Unfortunately, I haven't had time to complete/document it very well yet.

a subtheme can be set up with a drush fst

Again, that's what the other related issue is about. It's a very complex topic considering that there is both LESS and SASS support to consider.

ricksta’s picture

Ah, yes. I can see you've been making commits. Thanks for all the good work. I'll see if I can make this work.