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

[gatsby-remark-copy-linked-files] Fix regression from #2871 with RegExp cannons #2901

Merged
merged 9 commits into from
Nov 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions examples/using-remark-copy-linked-files/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"env": {
"browser": true
},
"globals": {
"graphql": false
}
}
3 changes: 3 additions & 0 deletions examples/using-remark-copy-linked-files/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
public
.cache
node_modules
5 changes: 5 additions & 0 deletions examples/using-remark-copy-linked-files/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# using-gatsby-remark-copy-linked-files

https://using-gatsby-remark-copy-linked-files.gatsbyjs.org

Stub README description
66 changes: 66 additions & 0 deletions examples/using-remark-copy-linked-files/gatsby-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
module.exports = {
siteMetadata: {
title: `Gatsby Starter Blog`,
author: `Kyle Mathews`,
},
plugins: [
{
resolve: `gatsby-source-filesystem`,
options: {
path: `${__dirname}/src/pages`,
name: `pages`,
},
},
{
resolve: `gatsby-transformer-remark`,
options: {
plugins: [
{
resolve: `gatsby-remark-responsive-iframe`,
options: {
wrapperStyle: `margin-bottom: 1.0725rem`,
},
},
`gatsby-remark-prismjs`,
// {
// resolve: `gatsby-remark-images`,
// options: {
// maxWidth: 740,
// },
// },
{
resolve: `gatsby-remark-copy-linked-files`,
options: {
// `ignoreFileExtensions` defaults to [`png`, `jpg`, `jpeg`, `bmp`, `tiff`]
// as we assume you'll use gatsby-remark-images to handle
// images in markdown as it automatically creates responsive
// versions of images.
//
// If you'd like to not use gatsby-remark-images and just copy your
// original images to the public directory, set
// `ignoreFileExtensions` to an empty array.
ignoreFileExtensions: [],
},
},
`gatsby-remark-smartypants`,
],
},
},
`gatsby-transformer-sharp`,
`gatsby-plugin-sharp`,
{
resolve: `gatsby-plugin-google-analytics`,
options: {
//trackingId: `ADD YOUR TRACKING ID HERE`,
},
},
`gatsby-plugin-offline`,
`gatsby-plugin-react-helmet`,
{
resolve: `gatsby-plugin-typography`,
options: {
pathToConfigModule: `src/utils/typography`,
},
},
],
}
44 changes: 44 additions & 0 deletions examples/using-remark-copy-linked-files/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const _ = require("lodash")
const Promise = require('bluebird')
const path = require('path')

exports.createPages = ({ graphql, boundActionCreators }) => {
const { createPage } = boundActionCreators

return new Promise((resolve, reject) => {
const blogPost = path.resolve("./src/templates/blog-post.js")
resolve(
graphql(
`
{
allMarkdownRemark(limit: 1000) {
edges {
node {
frontmatter {
path
}
}
}
}
}
`
).then(result => {
if (result.errors) {
console.log(result.errors)
reject(result.errors)
}

// Create blog posts pages.
_.each(result.data.allMarkdownRemark.edges, edge => {
createPage({
path: edge.node.frontmatter.path,
component: blogPost,
context: {
path: edge.node.frontmatter.path,
},
})
})
})
)
})
}
47 changes: 47 additions & 0 deletions examples/using-remark-copy-linked-files/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"name": "using-remark-copy-linked-files",
"private": true,
"description": "Gatsby example site on gatsby-remark-copy-linked-files",
"author": "Florian Kissling <sechskilo@gmail.com>",
"dependencies": {
"gatsby": "^1.9.108",
"gatsby-link": "^1.6.24",
"gatsby-plugin-google-analytics": "^1.0.12",
"gatsby-plugin-offline": "^1.0.10",
"gatsby-plugin-react-helmet": "^1.0.8",
"gatsby-plugin-sharp": "^1.6.20",
"gatsby-plugin-typography": "^1.7.10",
"gatsby-remark-copy-linked-files": "^1.5.20",
"gatsby-remark-images": "^1.5.31",
"gatsby-remark-prismjs": "^1.2.9",
"gatsby-remark-responsive-iframe": "^1.4.14",
"gatsby-remark-smartypants": "^1.4.8",
"gatsby-source-filesystem": "^1.5.8",
"gatsby-transformer-remark": "^1.7.20",
"gatsby-transformer-sharp": "^1.6.13",
"hast-util-to-html": "^3.1.0",
"lodash": "^4.15.0",
"react-responsive-grid": "^0.3.3",
"typeface-merriweather": "^0.0.35",
"typeface-montserrat": "^0.0.37",
"typography-theme-wordpress-2016": "^0.15.1"
},
"devDependencies": {
"eslint": "^4.9.0",
"eslint-plugin-react": "^7.4.0",
"gh-pages": "^0.12.0",
"prettier": "^1.8.1"
},
"license": "MIT",
"main": "n/a",
"scripts": {
"dev": "gatsby develop",
"lint": "./node_modules/.bin/eslint --ext .js,.jsx --ignore-pattern public .",
"test": "echo \"Error: no test specified\" && exit 1",
"format": "prettier --trailing-comma es5 --no-semi --single-quote --write 'src/**/*.js'",
"develop": "gatsby develop",
"build": "gatsby build",
"deploy": "gatsby build --prefix-paths && gh-pages -d public",
"fix-semi": "eslint --quiet --ignore-pattern node_modules --ignore-pattern public --parser babel-eslint --no-eslintrc --rule '{\"semi\": [2, \"never\"], \"no-extra-semi\": [2]}' --fix gatsby-node.js"
}
}
41 changes: 41 additions & 0 deletions examples/using-remark-copy-linked-files/src/components/Bio.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import React from 'react'

// Import typefaces
import 'typeface-montserrat'
import 'typeface-merriweather'

import profilePic from './profile-pic.jpg'
import { rhythm } from '../utils/typography'

class Bio extends React.Component {
render() {
return (
<div
style={{
display: 'flex',
marginBottom: rhythm(2.5),
}}
>
<img
src={profilePic}
alt={`Kyle Mathews`}
style={{
marginRight: rhythm(1 / 2),
marginBottom: 0,
width: rhythm(2),
height: rhythm(2),
}}
/>
<p>
Written by <strong>Kyle Mathews</strong> who lives and works in San
Francisco building useful things.{' '}
<a href="https://twitter.com/kylemathews">
You should follow him on Twitter
</a>
</p>
</div>
)
}
}

export default Bio
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions examples/using-remark-copy-linked-files/src/layouts/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import React from "react"
import Link from "gatsby-link"
import { Container } from "react-responsive-grid"

import { rhythm, scale } from "../utils/typography"

require(`prismjs/themes/prism-solarizedlight.css`)

class Template extends React.Component {
render() {
const { location, children } = this.props
let header

let rootPath = `/`
if (typeof __PREFIX_PATHS__ !== `undefined` && __PREFIX_PATHS__) {
rootPath = __PATH_PREFIX__ + `/`
}

if (location.pathname === rootPath) {
header = (
<h1
style={{
...scale(1.5),
marginBottom: rhythm(1.5),
marginTop: 0,
}}
>
<Link
style={{
boxShadow: `none`,
textDecoration: `none`,
color: `inherit`,
}}
to={`/`}
>
Gatsby Starter Blog
</Link>
</h1>
)
} else {
header = (
<h3
style={{
fontFamily: `Montserrat, sans-serif`,
marginTop: 0,
marginBottom: rhythm(-1),
}}
>
<Link
style={{
boxShadow: `none`,
textDecoration: `none`,
color: `inherit`,
}}
to={`/`}
>
Gatsby Starter Blog
</Link>
</h3>
)
}
return (
<Container
style={{
maxWidth: rhythm(24),
padding: `${rhythm(1.5)} ${rhythm(3 / 4)}`,
}}
>
{header}
{children()}
</Container>
)
}
}

export default Template
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading